<?php
$wsdl = 'http://blahblah/Service.asmx?WSDL';
$params = array('customerCode'=>'11111');
$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
'style'=>SOAP_RPC,
'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
);
try {
$soap = new SoapClient($wsdl, $options);
$data = $soap->GetCustomerAccountList($params);
}
catch(Exception $e) {
die($e->getMessage());
}
echo "String Dump<br>";
$res = $soap->__getLastResponse();
echo $res;
echo "<br>";
echo "<br>";
$user = new SimpleXMLElement('<?xml version="1.0"?><Response><Status code="201" text="Accepted" /><ResultList count="1"><Address addressID="XXXX"><Name>XXXXX</Name><PostalAddress><Street>XXXXXX</Street><City>XXXX</City><State>VIC</State><PostalCode>3175</PostalCode><Country>Australia</Country></PostalAddress><Phone name="Office"><TelephoneNumber><Number>XXXX</Number></TelephoneNumber></Phone><TaxDetail percentageRate="10.00">01</TaxDetail></Address></ResultList></Response>');
echo $user->ResultList->Address->Name;
echo "<br>";
echo $user->ResultList->Address->PostalAddress->Street;
echo "<br>";
I'm having problems with a script, first time I'm using a lot of these features.
My issue is with the $res
variable, if I take the xml
stored in the $res
variable and add it inside SimpleXMLRequest()
, everything works fine, but if I replace it with the $res
variable itself, it fails (no error, well, not sure how to output an error anyway.)
$res
outputs an XML string (all the tags strip when adding it here.)
Any help would be great.