XML SOAP Response Using SimpleXML

I am trying to convert a SOAP response to XML.

SOAP has a shell and a body

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> 

When i try to convert

 $responseXML = simplexml_load_string($string); 

I get

 object(SimpleXMLElement)#20 (0) { } 

If I edit $string as soap:Envelope and soap:Body , I can get the XML.

What happened to:? Unable to get XML.

Hope this is clear. Is anyone

+4
source share
2 answers

The SOAP message is already XML. The problem is that it has namespaces, so you need to access it in different ways. (The preceding colon is the namespace identifier.)

Here (google cached copy) is an example of using namespaces with SimpleXML.
Here is a specific example for reading SOAP messages.

+9
source

SimpleXML requires special handling for XML with names ( ref. )

+1
source

Source: https://habr.com/ru/post/1308886/


All Articles