Soap web-service not working (PHP) -


i have looked on stack overflow , found couple threads related did not solve problem. also, it's worth, ltl carrier name of estes trying work through.

here's code i'm using:

      $url = "http://www.estes-express.com/rating/ratequote/services/ratequoteservice?wsdl";     $username = 'un';     $password = 'pw';      $client = new soapclient($url);      //prepare soapheader parameters      $cred = array(          'user'      => $username,          'password'  => $password     );      $headers = new soapheader('http://ws.estesexpress.com/ratequote', 'auth', $cred);     $client->__setsoapheaders($header);      $params = array(          "requestid"         => "20131724",         "account"           => "9252066",         "originpoint"       => array('countrycode' => 'us', 'postalcode' => "43537"),         "destinationpoint"  => array('countrycode' => 'us', 'postalcode' => "43460"),         "payor"             => 's',         "terms"             => 'ppd',         "stackable"         => 'n',         "basecommodities"   => array('commodity' => array('class' => "55", 'weight' => "500") )     );      $return = $client->getquote(array("raterequest"=>$params));      return $return;  

here response getting: [client] soap-error: encoding: object has no 'requestid' property

any on great!

ps. have tried putting them in stdclass() objects not result. also, wsdl in code if want check out.

edited: here dump of request should like:

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rat="http://ws.estesexpress.com/ratequote" xmlns:rat1="http://ws.estesexpress.com/schema/2012/12/ratequote">    <soapenv:header>       <rat:auth>          <rat:user>xxxxx</rat:user>          <rat:password>xxxxxx</rat:password>       </rat:auth>    </soapenv:header>    <soapenv:body>       <rat1:raterequest>          <rat1:requestid>20131724</rat1:requestid>          <rat1:account>9252066</rat1:account>          <rat1:originpoint>             <rat1:countrycode>us</rat1:countrycode>             <rat1:postalcode>43537</rat1:postalcode>             <!--optional:-->             <rat1:city>maumee</rat1:city>             <!--optional:-->             <rat1:stateprovince>oh</rat1:stateprovince>          </rat1:originpoint>          <rat1:destinationpoint>             <rat1:countrycode>us</rat1:countrycode>             <rat1:postalcode>23237</rat1:postalcode>             <rat1:stateprovince>va</rat1:stateprovince>          </rat1:destinationpoint>          <rat1:payor>s</rat1:payor>          <rat1:terms>ppd</rat1:terms>          <rat1:stackable>n</rat1:stackable>          <rat1:basecommodities>             <!--1 99 repetitions:-->             <rat1:commodity>                <rat1:class>50</rat1:class>                <rat1:weight>100</rat1:weight>             </rat1:commodity>          </rat1:basecommodities>       </rat1:raterequest>    </soapenv:body> </soapenv:envelope> 

this caught me out other day, too: parameters expected soapclients called should not include outermost xml tag within body, in case raterequest, generated automatically based on description in wsdl. instead, need pass structure (array or object) containing each of parameters defined within outer tag.

so in case, need change this:

$return = $client->getquote(array("raterequest"=>$params)); 

to this:

$return = $client->getquote($params); 

incidentally, code pasted has typo define $headers reference $header. live demo both changes shows instead "user authentication failed." fault (presumably because wise enough not give real login details!)


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -