tags:

views:

195

answers:

2

Hi i am trying to convert a soap response to XML.

Soap has an envelop 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"&gt;
<soap:Body>

When try to convert

$responseXML = simplexml_load_string($string);

I get

object(SimpleXMLElement)#20 (0) { } 

If i edit the $string as soap-Envelope and soap-Body i can get the XML

Whats wrong with : and can not get XML

I hope its clear.

Anyone

+1  A: 

SimpleXML requires special treatment for namespaced XML (ref.)

Dormilich
Totally clear.But what about if i want to access for example xml->soap:Envelop->soap:Body->item1->item2
ntan
because "soap:" is not tied to a namespace in this example. mind that not the namespace prefix must match, but the namespace itself.
Dormilich
+2  A: 

A SOAP message is already XML. The problem is that it has namespaces so you have to access it differently. (The part before the colon is the identifier for the namespace.)

Here is an example of using namespaces with SimpleXML.
Here is a specific example for reading SOAP messages.

Guffa
Thank i have no words!
ntan