Reputation: 2974
I have imported a WSDL from a third party Java web service. One of the methods requires a ComplexType object, that was serialized into a class on C# when I imported the WSDL. The WSDL is as follows:
<xsd:complexType name="MethodReturn">
<xsd:sequence>
<xsd:element name="param1" nillable="true" type="xsd:string" />
<xsd:element name="param2" nillable="true" type="xsd:string" />
<xsd:element name="param3" nillable="true" type="xsd:string" />
<xsd:element name="param4" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
When I send the Method, I'm getting the error below:
org.xml.sax.SAXException: Invalid element in com.teste.webservice.model.MethodReturn - param3
The third party developer told me that I shouldn't send the param3
property along the serialized XML when I send the method. How can I accomplish this using C#? If I set MethodReturn=null, the property is included as xsil:nil="true", as follows:
<param1 xsi:type="xsd:string">U</param1>
<param2 xsi:type="xsd:string">2032290</param2>
<param3 xsi:nil="true"/>
<param4 xsi:type="xsd:string">EU1</param4>
What I would like to do is not to send param3
at all, like below. Is that possible?
<param1 xsi:type="xsd:string">U</param1>
<param2 xsi:type="xsd:string">2032290</param2>
<param4 xsi:type="xsd:string">EU1</param4>
Tks
Upvotes: 0
Views: 339
Reputation: 35477
Well either the 3rd party developer or the WSDL is wrong. If the WSDL is wrong, then edit it:
<xsd:complexType name="MethodReturn">
<xsd:sequence>
<xsd:element name="param1" nillable="true" type="xsd:string" />
<xsd:element name="param2" nillable="true" type="xsd:string" />
<xsd:element name="param3" type="xsd:string" />
<xsd:element name="param4" nillable="true" type="xsd:string" />
</xsd:sequence>
Upvotes: 1