I am using NUSOAP to interact with a freight company web service. After posting to this page I am supposed to see a rate quote on the screen. Someone else wrote the following page for me but I am not getting any results back on the page. Can someone take a look at this and see if there is something wrong? I have replaced my actual username and password for security reasons. Thank you for your time.
Here is my soap client page:
<?php
// Nusoap library 'nusoap.php' should be available through include_path directive
require_once('./lib/nusoap.php');
function doRate($oZip, $dZip, $oType, $Payment, $arShipment, $pCount, $pFeet, $cFeet, $arService, $arSegret, $arCod){
// set the URL or path to the WSDL document
$wsdl = "https://USERNAME:PASSWORD@www.rdfs.com/webservices/ratequote/ratequote.asmx?wsdl";
// instantiate the SOAP client object
$soap = new soapclient($wsdl,"wsdl");
// set credentials
$soap->setCredentials("USERNAME","PASSWORD");
// get the SOAP proxy object, which allows you to call the methods directly
$proxy = $soap->getProxy();
// set parameter parameters (RateQuote^)
$service = array("ServiceCode"=>$sCode);
$segret = array("Pieces"=>$Pieces);
$cod = array("PrePaid"=>$pPaid, "CODAmount"=>$cAmout);
$parameters = array("OriginZip"=>$oZip, "DestinationZip"=>$dZip, "OriginType"=>$$oType, "PaymentType"=>$Payment,
"ShipmentDetails"=>$arShipment, "PalletCount"=>$pCount, "LinearFeet"=>$pFeet, "CubicFeet"=>cFeet,
"ServiceDeliveryOptions"=>$arService, "SortSegregate"=>$arSegret, "COD"=>$arCod);
// get the result, a native PHP type, such as an array or string
$result = $proxy->RateQuote($parameters);
for ($i=0; $i<sizeof($result); $i++){
echo $result[$i];
}
}
$oZip = $_POST["oZip"];
$dZip = $_POST["dZip"];
$oType = $_POST["oType"];
$Payment = $_POST["payment"];
$pCount = $_POST["palletCount"];
$pFeet = $_POST["linearFeet"];
$cFeet = $_POST["cubicFeet"];
// Shipment Detail Options, could be more than one values. So, it could be actualClass1, actualClass2, ... actualClassn and weight1, weight2, ... weightn
$aActualClass_1 = $_POST["actualClass1"];
$aWeight_1 = $_POST["weight1"];
// Service Delivery Options, could be more than one values. So, it could be service1, service2, ... servicen
$aService_1 = $_POST["service1"];
// SortSegregate Options, could be more than one values . So, it could be pieces1, pieces2, ... piecesn
$aPieces_1 = $_POST["pieces1"];
// COD Fee, could be more than one values. So, it could be prePaid1, prePaid2, .... prePaidn and codAmount1, codAmount2, ... codAmountn
$aPrePaid_1 = $_POST["prePaid1"];
$aCODAmountValue_1 = $_POST["codAmount1"];
// Create array of Shipment Detail, with structure array("ActualClass"=>$ActualClassValue, "Weight"=>$WeightValue);
$shipment = array("ActualClass"=>$aActualClass_1, "Weight"=>$aWeight_1);
/*
If more than one, then:
array_push($shipment, "ActualClass"=>$aActualClass_2, "Weight"=>$aWeight_2);
...
array_push($shipment, "ActualClass"=>$aActualClass_n, "Weight"=>$aWeight_n);
*/
// Create array of Service Delivery Options, with structure array("ServiceCode"=>$ServiceCodeValue);
$service = array("ServiceCode"=>$aService_1);
/*
If more than one, then:
array_push($service, "ServiceCode"=>$aService_2);
...
array_push($service, "ServiceCode"=>$aService_n);
*/
// Create array of SortSegregate Options, with structure array("Pieces"=>$PiecesValue);
$regret = array("Pieces"=>$aPieces_1);
/*
If more than one, then:
array_push($regret, "Pieces"=>$aPieces_2);
...
array_push($regret, "Pieces"=>$aPieces_n);
*/
// Create array of COD Fee, with structure array("PrePaid"=>$PrePaidValue, "CODAmount"=>$CODAmountValue);
$cod = array("PrePaid"=>$aPrePaid_1, "CODAmount"=>$aCODAmountValue_1);
/*
If more than one, then:
array_push($cod, "PrePaid"=>$aPrePaid_2, "CODAmount"=>$aCODAmountValue_2);
...
array_push($cod, "PrePaid"=>$aPrePaid_n, "CODAmount"=>$aCODAmountValue_n);
*/
doRate($oZip, $dZip, $oType, $Payment, $shipment, $pCount, $pFeet, $cFeet, $service, $regret, $cod);
?>
Here is my form that posts to the above page:
<form action="service.php" method="post" name="form">
<label>oZip
<input type="text" name="oZip" />
</label>
<br />
<label>dZip
<input type="text" name="dZip" />
</label>
<br />
<label>oType
<input type="text" name="oType" />
</label>
<br />
<label>payment
<input type="text" name="payment" />
</label>
<br />
<label>palletCount
<input type="text" name="palletCount" />
</label>
<br />
<label>linearFeet
<input type="text" name="linearFeet" />
</label>
<br />
<label>cubicFeet
<input type="text" name="cubicFeet" />
</label>
<br />
<label>actualClass1
<input type="text" name="actualClass1" />
</label>
<br />
<label>weght1
<input type="text" name="weight1" />
</label>
<br />
<label>service1
<input type="text" name="service1" />
</label>
<br />
<label>pieces1
<input type="text" name="pieces1" />
</label>
<br />
<label>prePaid1
<input type="text" name="prePaid1" />
</label>
<br />
<label>codAmount1
<input type="text" name="codAmount1" />
</label>
<br />
<br />
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
<br />
</form>