1
votes

I have a WCF web service with a method that returns a complex data type. This data type is defined in an assembly reference that I don't have the source code for.

This data type has private fields and public properties for accessing them, but my service generates a WSDL where only the private fields are visible. For example, if the class in the assembly reference looks like this:

class ResponseStructure {
    private XmlElement bodyField;
    public XmlElemente Body { /*getters and setters for bodyField */ }
}

When I add this service as a service reference in any application and try to use ResponseStructure, not only do I have access to bodyField (which I can't even see from the service because the field is private), but I the actual Body property does not even show up.

The same thing happens if I try to chain WCF services, i.e, have service1 passing all requests through to service2, and then passing the response back. The data types from service2, when referenced in the WSDL of service1, only contain private fields.

What can I do about this, knowing that I have no access to either the reference assembly's or the service2's source code?

1

1 Answers

0
votes

Don't use a class you have no control over in the contract of a service that you're responsible for. Use a separate class and copy from the properties of the ResponseStructure class.