Extract SOAP Request Data
| From: | Jeffery Fernandez | Date: | Wed, 26 Sep 2007 07:52:40 +0000 |
| Subject: | Extract SOAP Request Data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-262476@lists.php.net to get a copy of this message | ||
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>&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>&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: [application/pgp-signature]
Attachment: [application/pgp-signature]