0

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

MrGlass
  • 9,094
  • 17
  • 64
  • 89

2 Answers2

1

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.

Mike
  • 8,767
  • 8
  • 49
  • 103
  • I'm trying to validate the response with xmllint, but I am unfamiliar with it. I am getting errors because there is no dtd defined, but I think the schema is defined in the document. Do you know the correct command? – MrGlass Jun 28 '12 at 18:03
  • Sorry, your best bet is to consult the documentation for XMLLint, or look for a different linter – Mike Jun 29 '12 at 08:28
0

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

Community
  • 1
  • 1
MrGlass
  • 9,094
  • 17
  • 64
  • 89