问题
I'm working with a Web Service that i didn't make and i'm getting two different responses from the same method, data is the same but format changes and that crashes my app
Response 1:
<SOAP-ENV:Envelope xmlns:SOAP-ENV=...>
<SOAP-ENV:Body SOAP-ENV:encodingStyle="..." xmlns:NS1="..." xmlns:NS2="...">
<NS1:...>
<return href="#1"/>
</NS1:...>
<NS2:..." xsi:type="NS2:...">
</NS2:...>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response 2:
<SOAP-ENV:Envelope xmlns:SOAP-ENV=...>
<SOAP-ENV:Body SOAP-ENV:encodingStyle="..." xmlns:NS1="..." xmlns:NS2="...">
<NS1:...>
<NS2:..." xsi:type="NS2:...">
</NS2:...>
<return href="#1"/>
</NS1:...>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The only diference are this lines
<return href="#1"/>
</NS1:...>
When I get the second one I cannot read the data, so my question is: Is the second way wrong?
EDIT:
This is the error message i get
System.Web.Services.Protocols.SoapException: El servidor no puede procesar la
solicitud.
---> System.InvalidOperationException: Error en el documento XML (2, 3726). --->
System.InvalidOperationException: No se encontró en el documento el elemento con id '2'
al que se hace referencia.
en System.Xml.Serialization.XmlSerializationReader.GetTarget(String id)
en System.Xml.Serialization.XmlSerializationReader.FixupArrayRefs(Object fixup)
en System.Xml.Serialization.XmlSerializationReader.DoFixups()
en System.Xml.Serialization.XmlSerializationReader.ReadReferencedElements()
it says "Can't find the element with id 2"
the second response was made because UTF8InHeader = TRUE
anyway I'm curious about if it is a valid soap response
回答1:
Your answer would be in the WSDL for this service. That is the "contract" with the outside world.
来源:https://stackoverflow.com/questions/24043496/what-is-the-correct-format-of-a-soap-response