-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_SOAP.php
20 lines (19 loc) · 1.08 KB
/
parse_SOAP.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
//simple solution to parse a SOAP XML Result
$soapXMLResult =
"<?xml version='1.0' encoding='utf-8'?><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:Header><Header
xmlns='http://www.example.com'>
<CustomerID>87654321</CustomerID><Username>test@email.com.au</Username>
<Password>test123</Password></Header></soap:Header><soap:Body>
<CreateRebillCustomerResponse xmlns='http://www.example.com'><CreateRebillCustomerResult>
<Result>Success</Result><ErrorSeverity /><ErrorDetails />
<RebillCustomerID>90246</RebillCustomerID></CreateRebillCustomerResult>
</CreateRebillCustomerResponse></soap:Body></soap:Envelope>";
$soap = simplexml_load_string($soapXMLResult);
$response = $soap->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children()->CreateRebillCustomerResponse;
$customerId = (string) $response->CreateRebillCustomerResult->RebillCustomerID;
echo 'The customer ID is: '.$customerId;
?>