I'm trying to get a SOAP request from a structure like:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:wseasyrent:wseasyrent">
<soapenv:Header/>
<soapenv:Body>
<urn:getcustomersv3>
<accessid></accessid>
<er_custcode></er_custcode>
<er_groupcode></er_groupcode>
<custcard></custcard>
<custextid></custextid>
<custextidorigin></custextidorigin>
<firstname></firstname>
<lastname></lastname>
<zip></zip>
<city></city>
<dateofbirth></dateofbirth>
<telephone></telephone>
<mobile></mobile>
<email></email>
<created_after></created_after>
<changed_after></changed_after>
<activity_after></activity_after>
<maxrows></maxrows>
</urn:getcustomersv3>
I've tried many methods, neither work as it should... here is the first part of my code:
$options = array(
"trace" => 1,
"cache_wsdl" => WSDL_CACHE_NONE
);
$client = new SoapClient($WebServiceHost, $options);
Trying with array:
$parr = array(
'accessid' => 'myPassword',
'er_custcode' => 'custCode'
);
try {
$ret = $client->getcustomersv3($parr);
} catch (Exception $e) {
$ret = $e->faultstring;
}
Result with array:
<ns1:getcustomersv3>
<accessid>Array</accessid>
<er_custcode></er_custcode>
Trying with object:
$obj = new StdClass();
$obj->accessid = 'myPassword';
$obj->er_custcode = 'custCode';
// or with format:
// $obj[] = new SoapVar('custCode', XSD_STRING, null, null, 'er_custcode' );
try {
$ret = $client->getcustomersv3(new SoapVar($parm, SOAP_ENC_OBJECT));
} catch (Exception $e) {
$ret = $e->faultstring;
}
Result with object:
<ns1:getcustomersv3>
<accessid>
<accessid>custCode</accessid>
<er_custcode>myPassword</er_custcode>
</accessid>
<er_custcode></er_custcode>
What I would need it to look like is:
<ns1:getcustomersv3>
<accessid>custCode</accessid>
<er_custcode>myPassword</er_custcode>
Thanks a lot!
The solution was inserting the params one by one like so:
$ez_soap = new SoapClient($pageURL,array('trace' => 1));
$response = $ez_soap->getcustomersv3($params[0],$params[1],'','','','','','','','',$params[2],'','','',$params[3],$params[4],$params[5],$params[6]);