Saturday, 26 January 2019

Calling FreightQuote API using PHP SoapClient

I am trying to call FreightQuote API using SoapClient for getting quote. I am getting response from there but with validation error. Following is my code and XML file: $apiHostPath = "https://b2b.Freightquote.com/WebService/QuoteService.asmx?wsdl"; $AuthClient = new SoapClient("https://soapserver.example.com/blahblah.asmx?wsdl"); $xmlString = file_get_contents("temp.xml"); $soapBody = new SoapVar($xmlString, XSD_ANYXML); $result = $AuthClient->GetRatingEngineQuote(array($soapBody)); echo get_class($result); print_r($result);

XML file:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
 <GetRatingEngineQuote xmlns="http://tempuri.org/">
 <request>
 <CustomerId>66916753</CustomerId>
 <QuoteType>B2B</QuoteType>
 <ServiceType>LTL</ServiceType>
 <QuoteShipment>
 <IsBlind>false</IsBlind>
 <PickupDate>2019-02-17T00:00:00</PickupDate>
 <SortAndSegregate>false</SortAndSegregate>
 <UseStackableFlag>false</UseStackableFlag>
 <DeclaredValue>20</DeclaredValue>
 <MaxPickupDate />
 <TLDeliveryDate />
 <TLEquipmentType>Any</TLEquipmentType>
 <TLEquipmentSize>Any</TLEquipmentSize>
 <TLTarpSizeType>NoTarpRequired</TLTarpSizeType>
 <ShipmentLocations>
 <Location>
 <LocationType>Origin</LocationType>
 <HasLoadingDock>false</HasLoadingDock>
 <IsConstructionSite>false</IsConstructionSite> 
 <RequiresInsideDelivery>false</RequiresInsideDelivery>
 <IsTradeShow>false</IsTradeShow>
 <TradeShow>TradeShowDesc</TradeShow>
 <IsResidential>false</IsResidential>
 <RequiresLiftgate>false</RequiresLiftgate>
 <HasAppointment>false</HasAppointment>
 <IsLimitedAccess>false</IsLimitedAccess>
 <LocationAddress>
 <PostalCode>60632</PostalCode>
 <CountryCode>US</CountryCode>
 </LocationAddress>
 <AdditionalServices />
 </Location>
 <Location>
 <LocationType>Destination</LocationType>
 <HasLoadingDock>false</HasLoadingDock>
 <IsConstructionSite>false</IsConstructionSite>
 <RequiresInsideDelivery>false</RequiresInsideDelivery>
 <IsTradeShow>false</IsTradeShow>
 <TradeShow>TradeShowDesc</TradeShow>
 <IsResidential>false</IsResidential>
 <RequiresLiftgate>false</RequiresLiftgate>
 <HasAppointment>false</HasAppointment>
 <IsLimitedAccess>false</IsLimitedAccess>
 <LocationAddress>
 <PostalCode>44113</PostalCode>
 <CountryCode>US</CountryCode>
 </LocationAddress>
 <AdditionalServices />
 </Location>
 </ShipmentLocations>
 <ShipmentProducts>
 <Product>
 <Class>55</Class>
 <Weight>1200</Weight>
 <Length>0</Length>
 <Width>0</Width>
 <Height>0</Height>
 <ProductDescription>Books</ProductDescription>
 <PackageType>Pallets_48x48</PackageType>
 <IsStackable>false</IsStackable>
 <DeclaredValue>0</DeclaredValue>
 <CommodityType>GeneralMerchandise</CommodityType>
 <ContentType>NewCommercialGoods</ContentType>
 <IsHazardousMaterial>false</IsHazardousMaterial>
 <NMFC />
 <DimWeight>0</DimWeight>
 <EstimatedWeight>0</EstimatedWeight>
 <PieceCount>5</PieceCount>
 <ItemNumber>0</ItemNumber>
 <ProductDrops />
 </Product>
 </ShipmentProducts>
 <ShipmentContacts />
 </QuoteShipment>
 </request>
 <user>
 <Name>****</Name>
 <Password>****</Password> 
 <CredentialType>Default</CredentialType>
 </user>
 </GetRatingEngineQuote>
 </soap:Body>
</soap:Envelope> 

Thank you in advanced.



from Calling FreightQuote API using PHP SoapClient

No comments:

Post a Comment