How to extract value using php soapclient

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have just started learning to program with PHP SOAPclient. I have
the following xml file and I want to extract/get the value

- <soap:Envelope xmlns:soap=" /
     - <soap:Body>
       - <ns2:deliverMDRecordsResponse xmlns:ns2="http://" xmlns:ns3=" /
        - <return>
             <ns3:Address> /
            - <ns3:ReferenceParameters>
xmlns:ResourceIdentifier=" " xmlns:wsa="http://">rs-1304338811289-11595</ResourceIdentifier:ResourceIdentifier>

My php script that is not working:

$source = 'resourceIdentifier.xml';

$xml = simplexml_load_string($source);
$xml->registerXPathNamespace('identifier', 'ns3');
foreach ($xml->xpath('//identifier:ResourceIdentifier') as $item)


I need help and thanks in advance.

- Ofuuzo

Re: How to extract value using php soapclient

Den 03-05-2011 10:49, ofuuzo skrev:

Quoted text here. Click to load it

But your example doesn't use the SOAP client?

It looks like you somehow captured a SOAP response and tries to
interpret it manually.
The idea of the SOAP client is to forget about the SOAP protocol and
call a remote function (almost) as if it was a local function.

What you should get from the SOAP client is a PHP object, that you can
use directly. Basically you should do something like:

   $client = new SoapClient('some.wsdl');
   $result = $client->RemoteFunction($a, $b, $c, ...);

The SOAP client is not the best documented part of PHP, but try to read and especially the client
part, if you haven't already been there.



Site Timeline