views:

34

answers:

0

I'm calling a SOAP 1.1 web service that I don't own and it's not strict about returning valid Xml. Specifically, when sending SOAP faults it's ignoring the order of sub-elements that are specified in the for the SOAP schema. The result is that when I call the service and it returns a SOAP fault I end up with a CommunicationException and that element "x" was expected but element "y" was found. The Xml is really close to being correct and if given the chance I could probably just parse it and get the data I need. Is there a setting on the web service reference that would force .NET to accept this slightly non-compliant Xml?

EDIT: The offending XML is this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"&gt;
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultactor/>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>DE-50002: Invalid ZIP Code ()</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SOAP 1.1 schema specifies:

<xs:complexType name="Fault" final="extension">
<xs:annotation>
<xs:documentation>
                                  Fault reporting structure
                                </xs:documentation>
</xs:annotation>

<xs:sequence>
<xs:element name="faultcode" type="xs:QName"/>
<xs:element name="faultstring" type="xs:string"/>
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0"/>
<xs:element name="detail" type="tns:detail" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

In my understanding (and this is certainly enforced by .NET) xs:sequence implies order so I think the XML does not comply with the schema.