Search code examples
xmlwcfserializationwscf

WCF SOAP payload content serialization with different types


I am dealing with a WSCF (Web Service Contract Firs) implementation where I received the XSDs files and the generic call as a WSDL file.

The generic SOAP call looks like this:

`<env:Body>
    <ns0:ProcessMessage xmlns:ns0="...">
        <ns0:payload>
            <ns0:content id="0">
                <ns1:ObjectToBeSerialize>`

I received the XSDs files with multiple objects that could be received in place of <ns1:ObjectToBeSerialize>. I generated all C# classes from the XSD and created an abstract class from 'content' class where I am adding the property to the specific classes but this approach is not working. I have also tried to use a partial class from 'content' class but I am not successful either.

Any ideas on how to implement this approach?


Solution

  • Using partial a Partial class should work for you. Make sure that the namespaces are correct in your attributes for your properties and classes.