I am trying to make a web service call from PHP to a SOAP web service with a sample request which looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.somedomain.com/">
<soapenv:Header/>
<soapenv:Body>
<ws:SearchMarketplaceSku>
<ws:Request>
<ws:Security>
<ws:PartnerKey>[suppressed]</ws:PartnerKey>
<ws:Password>[suppressed]</ws:Password>
</ws:Security>
<ws:AvailableOnDate>2012-04-03T00:00:00</ws:AvailableOnDate>
<ws:IncludeStateDetails>true</ws:IncludeStateDetails>
<ws:State>CA</ws:State>
</ws:Request>
</ws:SearchMarketplaceSku>
</soapenv:Body>
</soapenv:Envelope>
The PHP code being used is:
$soapClient = new SoapClient($wsdlUrl);
$ap_param = array('PartnerKey' => $PartnerKey, 'Password' => $metapackPassword, 'AvailableOnDate' => '2012-04-03T00:00:00','IncludeStateDetails'=>true, 'State'=>'CA');
$info = $soapClient->__call("SearchMarketplaceSku", $ap_param);
The web service call results in an "Request was not specified properly; server unable to deserialize request" error? What is the problem? Does the $ap_param array need to include all the nested nodes coressponding with the XML? Is there an easier way to make this call using "WSDL" mode?
Thanks for your help
PartnerKey and Password has to be in an Array under the key Security:
$ap_param = array(
'Security' => array(
'PartnerKey' => $PartnerKey,
'Password' => $metapackPassword
),
'AvailableOnDate' => '2012-04-03T00:00:00',
'IncludeStateDetails'=>true, 'State'=>'CA'
);