Extract SOAP Request Data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a SOAP request logger which logs all SOAP requests/responses being made on the system. What I want to do is extract the function name being called and the params passed to it. The following is an example XML Request:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope";
xmlns:ns1="urn:Gateway_Proxy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>
<env:Body>
  <ns1:make_proxy_payment env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";>
    <payment_id>61ecc268-1cd0-f468</payment_id>
    <payment_amount>15495</payment_amount>
    <callback_query_string>&amp;payment_id=61ecc268-1cd0-f468</callback_query_string>
    <transaction_note>Order from Student Library Fees with Payment Id: 61ecc268-1cd0-f468</transaction_note>
  </ns1:make_proxy_payment>
</env:Body>
</env:Envelope> 

What I want to do is extract the function name and the parameter names and its values.

I have done the folloing so far:
$soap_request_string = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"; xmlns:ns1="urn:Gateway_Proxy" xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:enc="http://www.w3.org/2003/05/soap-encoding";>
<env:Body>
  <ns1:make_proxy_payment env:encodingStyle="http://www.w3.org/2003/05/soap-encoding";>
    <payment_id>61ecc268-1cd0-f468</payment_id>
    <payment_amount>15495</payment_amount>
    <callback_query_string>&amp;payment_id=61ecc268-1cd0-f468</callback_query_string>
    <transaction_note>Order from Student Library Fees with Payment Id: 61ecc268-1cd0-f468</transaction_note>
  </ns1:make_proxy_payment>
</env:Body>
</env:Envelope>
XML;


$xml = new SimpleXMLElement($soap_request_string, NULL, false);
print_r($xml);
$ns = $xml->getNamespaces(true);
print_r($ns);
foreach ($xml->xpath('//env:Body') as $body)
{
    //print_r($body);
    foreach ($body->children($ns['env'], true) as $child)
    {
        print_r($child);
    }
} 

which does not return any SimpleXMLElements Objects. I can't figure out how to extract the values which are tied to the Name Space.

A description of the problem is in detail here: http://www.devnetwork.net/forums/viewtopic.php?t=74161

regards,
Jeffery
-- 
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia

Attachment: pgpFEiuPsZVnU.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux