Hello, I am trying to consume a web service using nusoap. I am having trouble getting it to work… Here is my code…
<?php
require_once('lib/nusoap.php');
$time = strtotime( $date );
$myDate = date( 'y-m-d', $time );
$request = array('request' => array(
'CustomerId' => '967636',
'QuoteType' => 'B2B',
'ServiceType' => 'LTL',
'QuoteShipment' => array(
'ShipmentLabel' => 'test b2b',
'IsBlind' => 'False',
'HazardousMaterialContactName' => 'Tyler h',
'HazardousMaterialContactPhone' => '9139999999',
'PickupDate' => '2010-11-28T16:00:00.000Z',
'ShipmentLocations' => array(
'Location' => array(
'LocationType' => 'Origin',
'LocationType' => 'Origin',
'LocationAddress' => array (
'PostalCode' => '66209',
'CountryCode' => 'US')
),
'Location' => array(
'LocationType' => 'Destination',
'LocationType' => 'Destination',
'LocationAddress' => array (
'PostalCode' => '66209',
'CountryCode' => 'US')
)),
'ShipmentProducts' => array(
'Product' => array(
'PackageType' => 'Pallets_48x40',
'Weight' => '200',
'Length' => '20',
'Width' => '20',
'Height' => '20',
'CommodityType' => 'GeneralMerchandise',
'ContentType' => 'NewCommercialGoods',
'IsHazardousMaterial' => 'False',
'PieceCount' => '1')
))),
'user' => array(
'Name' => 'xmltest@freightquote.com',
'Password' => 'xml'));
print_r($request);
$soapClient = new nusoap_client("http://b2b.freightquote.com/WebService/QuoteService.asmx?WSDL", $request);
$result = $soapClient->call("GetRatingEngineQuote", $request);
print_r($result);
?>
and here is what it returns…
Array
(
[request] => Array
(
[CustomerId] => 967636
[QuoteType] => B2B
[ServiceType] => LTL
[QuoteShipment] => Array
(
[ShipmentLabel] => test b2b
[IsBlind] => False
[HazardousMaterialContactName] => Tyler h
[HazardousMaterialContactPhone] => 9139999999
[PickupDate] => 2010-11-28T16:00:00.000Z
[ShipmentLocations] => Array
(
[Location] => Array
(
[LocationType] => Destination
[LocationAddress] => Array
(
[PostalCode] => 66209
[CountryCode] => US
)
)
)
[ShipmentProducts] => Array
(
[Product] => Array
(
[PackageType] => Pallets_48x40
[Weight] => 200
[Length] => 20
[Width] => 20
[Height] => 20
[CommodityType] => GeneralMerchandise
[ContentType] => NewCommercialGoods
[IsHazardousMaterial] => False
[PieceCount] => 1
)
)
)
)
[user] => Array
(
[Name] => xmltest@freightquote.com
[Password] => xml
)
)
Array
(
[GetRatingEngineQuoteResult] => Array
(
[QuoteId] => 0
[QuoteDateTime] => 2010-01-19T10:15:51.4305286-06:00
[QuoteExpiration] => 2010-02-18T10:15:51.4305286-06:00
[QuoteDurationMilliseconds] => 0
[UnitOfMeasureType] => English
[QuoteCarrierOptions] =>
[ValidationErrors] => Array
(
[B2BError] => Array
(
[ErrorType] => Validation
[ErrorMessage] => First Location in list must be origin.
)
)
)
)