Important note: We still support the operation of Ship Advisor 1.0 but the product is discontinued and we no longer make any new deployments. Please see our documentation for Ship Advisor 2.0 which will eventually replace Ship Advisor 1.0. |
Here are some sample code the most common functions in ShipAdvisor. Copy the code into a PHP file and you should see the result as provided in the sample when running the site.
GetFreightProductsForShipment:
<?php //Soap Client $Soap_client = new SoapClient('http://www.consignorsupport.no/ShipAdvisor/Main.asmx?WSDL'); //Soap Header $Soap_header = new SoapHeader('SoapAuthenticator', 'ServiceAuthenticationHeader', array('Username'=>'Flexerman21073', 'Password'=>'Gm15/46exRF')); //Set the Headers of Soap Client. $Soap_client->__setSoapHeaders($Soap_header); //Receiver $Receiver = array( 'CountryCode' => 'NO', 'PostCode' => '0580' ); //Shipment and goods line $Shipment = array( 'Shipment' => array( 'WebShopId'=> 104, 'CODAmount'=> 0, 'Lines'=> array( 'WebShopLine'=> array( 'NumberOfPackages'=> 1, 'PackageWeight' => 5000) ), 'Shopper' => $Receiver ), 'deliveryTypeOrder' => 10 ); //Call ShipAdvisor $FreightProducts = $Soap_client->GetFreightProductsForShipment($Shipment); //Show result in data dump echo "<pre>"; var_dump($FreightProducts); echo "</pre>"; ?>
Data dump:
object(stdClass)#3 (1) { ["GetFreightProductsForShipmentResult"]=> object(stdClass)#4 (2) { ["ProductInfoList"]=> object(stdClass)#5 (1) { ["SuitedProductInfo"]=> array(5) { [0]=> object(stdClass)#6 (9) { ["WebShopProductId"]=> int(2220130004) ["ConceptId"]=> int(0) ["CustomProductDBId"]=> int(4311) ["ServiceIds"]=> object(stdClass)#7 (0) { } ["ProductName"]=> string(14) "Custom Product" ["DeliveryTime"]=> string(9) "2-5 dager" ["Price"]=> float(74.12) ["CurrencyCode"]=> string(3) "NOK" ["SupportsPickDropPoint"]=> bool(true) } [1]=> object(stdClass)#8 (10) { ["WebShopProductId"]=> int(2220130002) ["ConceptId"]=> int(1041) ["CustomProductDBId"]=> NULL ["ServiceIds"]=> object(stdClass)#9 (0) { } ["ProductName"]=> string(26) "Klimanøytral Servicepakke" ["DeliveryTime"]=> string(9) "2-5 dager" ["Price"]=> float(84) ["CurrencyCode"]=> string(3) "NOK" ["InfoFromCarrier"]=> string(135) "Added fee 'brev-varsling' (NOK 5.00) to base price of SERVICEPAKKE since request did not have additional service 'eVarsling' specified." ["SupportsPickDropPoint"]=> bool(false) } [2]=> object(stdClass)#10 (9) { ["WebShopProductId"]=> int(2220130003) ["ConceptId"]=> int(1042) ["CustomProductDBId"]=> NULL ["ServiceIds"]=> object(stdClass)#11 (0) { } ["ProductName"]=> string(10) "På Døren" ["DeliveryTime"]=> string(9) "2-5 dager" ["Price"]=> float(107) ["CurrencyCode"]=> string(3) "NOK" ["SupportsPickDropPoint"]=> bool(false) } [3]=> object(stdClass)#12 (9) { ["WebShopProductId"]=> int(2220130001) ["ConceptId"]=> int(57) ["CustomProductDBId"]=> NULL ["ServiceIds"]=> object(stdClass)#13 (0) { } ["ProductName"]=> string(22) "Stykkgods Hjemlevering" ["DeliveryTime"]=> string(9) "2-5 dager" ["Price"]=> float(153) ["CurrencyCode"]=> string(3) "NOK" ["SupportsPickDropPoint"]=> bool(false) } [4]=> object(stdClass)#14 (8) { ["WebShopProductId"]=> int(2220130018) ["ConceptId"]=> int(1063) ["CustomProductDBId"]=> NULL ["ServiceIds"]=> object(stdClass)#15 (0) { } ["ProductName"]=> string(21) "Bring Cargo Stykkgods" ["Price"]=> float(326) ["CurrencyCode"]=> string(3) "NOK" ["SupportsPickDropPoint"]=> bool(false) } } } ["ErrorMessage"]=> string(0) "" } }
SearchForDropPoints:
<?php //Soap Client. $Soap_client = new SoapClient('http://www.consignorsupport.no/ShipAdvisor/Main.asmx?WSDL'); //Soap Header. $Soap_header = new SoapHeader('SoapAuthenticator', 'ServiceAuthenticationHeader', array('Username'=>'Flexerman21073', 'Password'=>'Gm15/46exRF')); //Set the Headers of Soap Client. $Soap_client->__setSoapHeaders($Soap_header); //Input parameters, set limit on the search $Params = array( 'productConceptID'=> 60, 'installationID' => '10916000028', 'country' => 'NO', 'postCode' => '0580', 'limit' => 2 ); //Get drop points $DropPoints = $Soap_client->SearchForDropPoints($Params); //Show result in data dump echo "<pre>"; var_dump($DropPoints); echo "</pre>"; ?>
Data dump:
object(stdClass)#3 (1) { ["SearchForDropPointsResult"]=> object(stdClass)#4 (1) { ["DropPointData"]=> array(2) { [0]=> object(stdClass)#5 (12) { ["OriginalId"]=> string(7) "3425964" ["ESId"]=> string(10) "60E3425964" ["Depot"]=> string(3) "001" ["Name1"]=> string(15) "KIWI 380 ØKERN" ["Address1"]=> string(11) "ØKERNV 145" ["PostalCode"]=> string(4) "0580" ["City"]=> string(4) "OSLO" ["CountryCode"]=> string(2) "NO" ["MapRefX"]=> float(10.8046674008) ["MapRefY"]=> float(59.9285430258) ["Distance"]=> float(0.382) ["KeyValueList"]=> object(stdClass)#6 (1) { ["KeyValue"]=> object(stdClass)#7 (3) { ["Key"]=> string(17) "SupportedProducts" ["Value"]=> string(2) "60" ["Type"]=> string(6) "String" } } } [1]=> object(stdClass)#8 (12) { ["OriginalId"]=> string(7) "3096369" ["ESId"]=> string(10) "60E3096369" ["Depot"]=> string(3) "001" ["Name1"]=> string(11) "RIMI SINSEN" ["Address1"]=> string(10) "SINSENV 55" ["PostalCode"]=> string(4) "0585" ["City"]=> string(4) "OSLO" ["CountryCode"]=> string(2) "NO" ["MapRefX"]=> float(10.7914303129) ["MapRefY"]=> float(59.9346034255) ["Distance"]=> float(0.882) ["KeyValueList"]=> object(stdClass)#9 (1) { ["KeyValue"]=> object(stdClass)#10 (3) { ["Key"]=> string(17) "SupportedProducts" ["Value"]=> string(2) "60" ["Type"]=> string(6) "String" } } } } } }
CreateConfirmedOrder:
<?php //Soap Client. $Soap_client = new SoapClient('http://www.consignorsupport.no/ShipAdvisor/Main.asmx?WSDL'); //Soap Header. $Soap_header = new SoapHeader('SoapAuthenticator', 'ServiceAuthenticationHeader', array('Username'=>'Flexerman21073', 'Password'=>'Gm15/46exRF')); //Set the Headers of Soap Client. $Soap_client->__setSoapHeaders($Soap_header); //Receiver $Receiver = array( 'Name' => 'Consignor AS', 'Address' => 'Lørenvangen 22', 'PostCode' => '0580', 'City' => 'OSLO', 'CountryCode' => 'NO' ); //Selected Drop point Data $DropPointData = array( 'OriginalId'=> '3425964', 'Name1' => 'KIWI 380 ØKERN', 'Address1' => 'ØKERNV 145', 'PostalCode' => '0580', 'City' => 'OSLO', 'CountryCode' => 'NO', 'MapRefX' => 0, 'MapRefY' => 0, 'Distance' => 0 ); //Assign values to selectedProduct $SelectedProduct = array( 'WebShopProductId' => 1040009, 'Price' => 75, 'CurrencyCode' => 'NOK', 'DropPoint' => $DropPointData ); //Create shipment and goods line $Shipment = array( 'Shipment' => array( 'WebShopId' => 104, 'OrderNumber' => '344', 'CODAmount' => 0, 'CurrencyCode' => 'NOK', 'Lines' => array( 'WebShopLine' => array( 'NumberOfPackages' => 1, 'PackageWeight' => 5000) ), 'Shopper' => $Receiver ), 'Product' => $SelectedProduct ); //Call ShipAdvisor $Result = $Soap_client->CreateConfirmedOrder($Shipment); //Show result in data dump echo "<pre>"; var_dump($Result); echo "</pre>"; ?>
Data dump (Order uploaded successfully)
object(stdClass)#3 (1) { ["CreateConfirmedOrderResult"]=> object(stdClass)#4 (2) { ["ChODId"]=> int(6281) ["ErrorCode"]=> int(0) } }