0

I'm new in SOAP and i'm having an issue in SOAP response.

My response is a xml string with value:

<?xml version="1.0" encoding="UTF-8"?><InterXXXX><PDFXXXXs><PDFXXXX> <InterlXXXKey>19.1112</InterXXXKey><Data></Data><ResultCode>2500</ResultCode> <ResultMessage>this is a test</ResultMessage> <RecordDateTime>2014-12-18 23:56:06.761</RecordDateTime></PDFXXXX></PDFXXXXs></InterXXXX>

When I'm trying to do:

$result = simplexml_load_string($xml); 

It doesn't create anything. But if i take the result and manual (copy-paste after print_r) create a new value like this

$xml2 = '<?xml version="1.0" encoding="UTF-8"?> <InterXXXX> <PDFXXXXs> <PDFXXXX> <InterlXXXKey>19.1112</InterXXXKey> <Data></Data> <ResultCode>2500</ResultCode> <ResultMessage>this is a test</ResultMessage> <RecordDateTime>2014-12-18 23:56:06.761</RecordDateTime> </PDFXXXX> </PDFXXXXs> </InterXXXX>';

and call

$result2 = simplexml_load_string($xml2);

It doesn't have any problems and create SimpleXMLElement Object () with all tags elements inside.

Why is it happening?

How can I handle my response to take the values in the tags?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Steven
  • 1
  • What is the output of: `echo $xml;`? – Rizier123 Dec 18 '14 at 22:19
  • Are you trying to use `SoapClient` or `SoapServer`? – Machavity Dec 18 '14 at 22:22
  • The out of echo $xml is the first xml i given. When im making echo $echo ->output = 19.11122500 this is a test 2014-12-18 23:56:06.761 – Steven Dec 19 '14 at 07:08
  • And im using SoapClient . Im making new SoapCLient with the wsdl link and i call the function i want. The answer im taking is a string and when echo the output is the $xml i give. – Steven Dec 19 '14 at 07:09
  • Please provide a hex-dump of the output string. See here how to create a hexdump: [How can I get a hex dump of a string in PHP?](http://stackoverflow.com/q/1057572/367456) – hakre Dec 19 '14 at 15:30

0 Answers0