PHP SoapClient cannot generate valid soap request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Below you will find my PHP script and a valid request generated by a soap
software.

I cannot figure out what I am doing wrong in the php script. Maybe it is
the array of elements that is wrong. Please help.

Thanks

PHP script:
-----------------
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

$soapClient = new SoapClient("
https://webservices.rrts.com/rating/ratequote.asmx?WSDL";, array('trace' =>
1));
$ns = 'https://webservices.rrts.com/ratequote/';
$headerBody = array(
        'UserName'          => "*************"
        , 'Password'       => "***************"
        , 'Site'       => "******************"
);
$header = new SOAPHeader($ns, 'AuthenticationHeader', $headerBody);
$soapClient->__setSoapHeaders($header);

$args=array(
        'OriginZip' => 18106
        ,'DestinationZip' => 91752
        ,'ShipmentDetails' => array(
            'ActualClass' => 50
            ,'Weight' => 1200
        )
        ,'OriginType' => 'O'
        ,'PaymentType' => 'P'
        ,'COD' => array(
            'Prepaid' => true
            ,'CODAmount' => 1200.00
        )
);

try {
    $results = $soapClient->__soapCall("RateQuote", array($args));
}
catch (Exception $ex) {
    var_dump($ex->getMessage());
    var_dump($soapClient->__getLastRequest());
    var_dump($soapClient->__getLastResponse());
}


Valid request generated by soap software
-----------------------------------------------------------
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope";
xmlns:rat="https://webservices.rrts.com/ratequote/";>
   <soap:Header>
      <rat:AuthenticationHeader>
         <!--Optional:-->
         <rat:UserName>xxxxx</rat:UserName>
         <!--Optional:-->
         <rat:Password>xxxxx</rat:Password>
         <!--Optional:-->
         <rat:Site>xxxxxx</rat:Site>
      </rat:AuthenticationHeader>
   </soap:Header>
   <soap:Body>
      <rat:RateQuote>
         <!--Optional:-->
         <rat:request>
            <!--Optional:-->
            <rat:OriginZip>18106</rat:OriginZip>
            <!--Optional:-->
            <rat:DestinationZip>91752</rat:DestinationZip>
            <!--Optional:-->
            <rat:ShipmentDetails>
               <!--Zero or more repetitions:-->
               <rat:ShipmentDetail>
                  <rat:ActualClass>50</rat:ActualClass>
                  <rat:Weight>1200</rat:Weight>
               </rat:ShipmentDetail>
            </rat:ShipmentDetails>
            <!--Optional:-->
            <rat:OriginType>O</rat:OriginType>
            <!--Optional:-->
            <rat:PaymentType>P</rat:PaymentType>

            <rat:COD>
               <rat:Prepaid>true</rat:Prepaid>
               <rat:CODAmount>1200.00</rat:CODAmount>
            </rat:COD>
         </rat:request>
      </rat:RateQuote>
   </soap:Body>
</soap:Envelope>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux