1

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?

Thiago
  • 39
  • 5
  • It seems that the partial class approach should work, do you have the correct namespace attributes etc? What type of errors are you getting? – Popo Dec 18 '18 at 20:09
  • Partial class solves the problem, as you said I just need to make sure the namespace was correct and also flag IsNullable=true. – Thiago Dec 19 '18 at 17:02
  • glad to hear it, I posted an answer as well for the sake of it. – Popo Dec 19 '18 at 17:12

2 Answers2

1

Thanks to @Popo I figure that I did not use the proper namespace and also the flag IsNullable = true.

[System.Xml.Serialization.XmlElementAttribute(ElementName ="ElementName", Namespace = "Namespace", IsNullable = true)]        
Thiago
  • 39
  • 5
0

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

Popo
  • 2,402
  • 5
  • 33
  • 55