MrGlass
MrGlass

Reputation: 9262

Interacting with .net SOAP services using PHP

I have a working SOAP request from my website to a .net based API. For some reason, PHP seems to be having issues parsing the response.

When I dump the response, most of the retrieved data is in a string named "any". This string seems to be a copy of the returned XML. Its too big to paste in this question, but you can view the response content here: http://pastie.org/4165973

I have tried loading this string in simplexml, but I get an error: "Extra content at the end of the document ".

Has anyone experienced similar issues? How can I parse this response?

edit I saved __getLastResponse() to a file to get as raw an output as possible. New XML is here http://pastebin.com/3ZtjDbjw

Upvotes: 0

Views: 235

Answers (2)

MrGlass
MrGlass

Reputation: 9262

The xml was not malformed. instead, the issue was related to namespaces. I ended up solving it with the help of PHP Parse Soap Reponse Issue - SimpleXMLElement and Parse XML with Namespace using SimpleXML

Upvotes: 0

Mike
Mike

Reputation: 8877

The XML looks malformed. <ShipToAddress> is probably incorrect, but it contains CDATA which might be what is breaking the parser.

In any case, run it through an XML linter (http://xmlsoft.org/xmllint.html) and see what it has to say. However, my guess is that the source API is either spitting it out incorrectly or you're doing something to it before printing it out, so what you provided isn't actually the live output.

Upvotes: 1

Related Questions