southbeach
Programmer
Decided to open a new thread in hope that this time around I can provide more specific info and therefore, get some direction to finally fix this
Attached is the PDF document I have been provided by service provider or hosting company. Within, please look at GetLTLRates Method.
My PHP code
I have been pounding my head for almost a week and have written at least four versions of this code as an attempt to submit parameters in XML, as array (as above), using stdClass() and using a sequence of SoapVar() commands into array as follows $param=array(); $param[]=new SoapVar(....) - No matter what I tried, all of them fail with same or different errors.
here is the error I get as I submit using above code
If I try to use SOAP 1.2, the error changes to a totally different error and service provider has been less than helpful in this process. I just cannot believe I have hit such a brick wall with this - never before in over 15 years of development. :-(
Thank you all for your assistance!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
Attached is the PDF document I have been provided by service provider or hosting company. Within, please look at GetLTLRates Method.
My PHP code
Code:
<?php
$ClientCode ='AAAA';
$ProfileCode ='AAAA';
$DestCity =trim($_REQUEST['DestCity']);
$DestCountry =trim($_REQUEST['DestCountry']);
$DestState =trim($_REQUEST['DestState']);
$DestZip =trim($_REQUEST['DestZip']);
$OrigCity =trim($_REQUEST['OrigCity']);
$OrigCountry =trim($_REQUEST['OrigCountry']);
$OrigState =trim($_REQUEST['OrigState']);
$OrigZip =trim($_REQUEST['OrigZip']);
$RequestId =trim($_REQUEST['RequestId']);
$ShipmentDate =trim($_REQUEST['ShipmentDate']);
$SrvToken ='335D6759802A4DBEB41CD6D68AB3024D';
$srvToken ='335D6759802A4DBEB41CD6D68AB3024D';
$usrName ='bbbbb';
$usrPassword ='ccccc';
$miles =0;
$scac ='';
$servicelevel ='';
$zonecode ='';
$route ='';
$mode ='';
$clientresponse='';
$date =trim($_REQUEST['ShipmentDate']);
$ini = ini_set("soap.wsdl_cache_enabled","0"); // disable wsdl catching
for($x=0; $x<5; $x++) {
if($_REQUEST['class'][$x] != '') {
if($_REQUEST['weight'][$x] != '') {
$hgt=trim($_REQUEST['height'][$x]); $hgt=intval($hgt*1);
$units=trim($_REQUEST['units'][$x]); $units=intval($units*1);
$pieces=trim($_REQUEST['pieces'][$x]); $pieces=intval($pieces*1);
$pallets=trim($_REQUEST['pallets'][$x]); $pallets=intval($pallets*1);
$length=trim($_REQUEST['length'][$x]); $length=intval($length*1);
$width=trim($_REQUEST['width'][$x]); $width=(number_format($width, 2, ".","")*1);
$weight=trim($_REQUEST['weight'][$x]); $weight=(number_format($weight, 2, ".","")*1);
$cubicfeet=trim($_REQUEST['cubicfeet'][$x]); $cubicfeet=$cubicfeet*1;
$haz=FALSE;
if($_REQUEST['hazmat'][$x] != '') { $haz=TRUE; }
$shipments['Shipment'][$x]=array(
'Class'=>trim($_REQUEST['class'][$x]),
'HazMat'=>$haz,
'Height'=>$hgt,
'Length'=>$length,
'Pallets'=>$pallets,
'Pieces'=>$pieces,
'Units'=>$units,
'Weight'=>$weight,
'Width'=>$width,
'CubicFeet'=>$cubicfeet);
}
}
}
// For Sandbox Mode, Please Use:
$opts = array('ssl' => array('ciphers'=>'RC4-SHA', 'verify_peer'=>false, 'verify_peer_name'=>false));
$params = array ('encoding' => 'UTF-8', 'verifypeer' => false, 'verifyhost' => false, 'soap_version' => SOAP_1_1, 'trace' => 1, 'exceptions' => 1, "connection_timeout" => 180);
try {
$link = new SoapClient("[URL unfurl="true"]https://saastransportation.com:4433/services/wcf/ShipmentLiteService.svc?WSDL",[/URL] $params);
//$link = new SoapClient("[URL unfurl="true"]http://rc.saastransportation.com/services/wcf/ShipmentLiteService.svc?WSDL",[/URL] $params);
} catch (SoapFault $e) {
echo '<div style="background: white;">';
echo '<p>Client Link Error:</p>';
echo '<pre style="background: white;">';
print_r($e);
echo '</pre></div>';
//output debug info
print "<pre style='background: green;'>";
print "Request :\n".htmlspecialchars($link->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($link->__getLastResponse())."\n";
print "</pre>";
exit;
}
// For Production Mode, Please Use:
// $link = new SoapClient("[URL unfurl="true"]https://saastransportation.com/services/wcf/ShipmentLiteService.svc?WSDL");[/URL]
/* Set parameters for the request */
$params = array("userName"=>'admintrinity',"password" => 'trinity11003',"srvToken" => '335D6759802A4DBEB41CD6D68AB3024D');
try {
$resp=$link->Login($params);
} catch (SoapFault $e) {
echo '<div style="background: white;">';
echo '<p>Login Error:</p>';
echo '<pre style="background: white;">';
print_r($e);
echo '</pre>'
. '<p> </p><p>Parameter Used:<pre>'.htmlspecialchars($params).'</pre></p>'
. '</div>';
//output debug info
print "<pre style='background: green;'>";
print "Request :\n".htmlspecialchars($link->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($link->__getLastResponse())."\n";
print "</pre>";
exit;
}
$userToken=($resp->LoginResult);
$UserToken =trim($userToken);
$ClientToken =trim($userToken);
echo 'Just go userToken: '.$userToken.'<br />';
$param=array(
'ClientCode' =>'aaaaaa',
'ProfileCode' =>'aaaaaa',
'ClientToken' =>trim($userToken),
'DestCity' =>trim($_REQUEST['DestCity']),
'DestCountry' =>trim($_REQUEST['DestCountry']),
'DestState' =>trim($_REQUEST['DestState']),
'DestZip' =>trim($_REQUEST['DestZip']),
'OrigCity' =>trim($_REQUEST['OrigCity']),
'OrigCountry' =>trim($_REQUEST['OrigCountry']),
'OrigState' =>trim($_REQUEST['OrigState']),
'OrigZip' =>trim($_REQUEST['OrigZip']),
'RequestId' =>trim($_REQUEST['RequestId']),
'ShipmentDate' =>trim($_REQUEST['ShipmentDate']),
'Shipments' =>$shipments,
'srvToken' =>'335D6759802A4DBEB41CD6D68AB3024D',
'userToken' =>trim($userToken),
);
try {
//$results = $link->__soapCall('GetLTLRates', $param);
$results=$link->GetLTLRates($param);
//$results=$link->GetLTLRates(str_replace(PHP_EOL, '', $param));
} catch (SoapFault $e) {
echo '<div style="background: white;">';
echo '<p>Submit Rate Request Error:</p>';
echo '<pre style="background: white;">';
print_r(htmlspecialchars($e));
echo '</pre>'
. '<p> </p><p>Parameter Used:<pre>'.var_dump($param).'</pre></p>'
. '</div>';
//output debug info
print "<pre style='background: green;'>";
print "Request :\n".htmlspecialchars($link->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($link->__getLastResponse())."\n";
print "</pre>";
exit;
}
echo '<div style="background-color: yellow;"><br />Here is the dump:<br />'.var_dump($results).'<div style="clear: both;"> </div></div>';
?>
I have been pounding my head for almost a week and have written at least four versions of this code as an attempt to submit parameters in XML, as array (as above), using stdClass() and using a sequence of SoapVar() commands into array as follows $param=array(); $param[]=new SoapVar(....) - No matter what I tried, all of them fail with same or different errors.
here is the error I get as I submit using above code
Code:
SoapFault exception: [a:InternalServiceFault] Object reference not set to an instance of an object. in /usr/lib/apache2/htdocs-dev/include/saasarray.php:136
Stack trace:
#0 [internal function]: SoapClient->__call('GetLTLRates', Array)
#1 /usr/lib/apache2/htdocs-dev/include/saasarray.php(136): SoapClient->GetLTLRates(Object(SoapParam))
#2 /usr/lib/apache2/htdocs-dev/ajax/ajaxControl.php(70): include('/usr/lib/apache...')
#3 {main}array(16) {
["ClientCode"]=>
string(5) "aaaaaa"
["ProfileCode"]=>
string(5) "aaaaaa"
["ClientToken"]=>
string(10) "dxdxdxdx"
["DestCity"]=>
string(10) "GRACEVILLE"
["DestCountry"]=>
string(2) "US"
["DestState"]=>
string(2) "MN"
["DestZip"]=>
string(5) "56210"
["OrigCity"]=>
string(7) "JAMAICA"
["OrigCountry"]=>
string(2) "US"
["OrigState"]=>
string(2) "NY"
["OrigZip"]=>
string(5) "11400"
["RequestId"]=>
string(13) "56759d2b09236"
["ShipmentDate"]=>
string(10) "2015-12-25"
["Shipments"]=>
array(1) {
["Shipment"]=>
array(1) {
[0]=>
array(10) {
["Class"]=>
string(2) "50"
["HazMat"]=>
bool(false)
["Height"]=>
int(40)
["Length"]=>
int(48)
["Pallets"]=>
int(1)
["Pieces"]=>
int(20)
["Units"]=>
int(20)
["Weight"]=>
float(250.2)
["Width"]=>
float(40)
["CubicFeet"]=>
int(12)
}
}
}
["srvToken"]=>
string(32) "335D6759802A4DBEB41CD6D68AB3024D"
["userToken"]=>
string(10) "dxdxdxdx"
}
If I try to use SOAP 1.2, the error changes to a totally different error and service provider has been less than helpful in this process. I just cannot believe I have hit such a brick wall with this - never before in over 15 years of development. :-(
Thank you all for your assistance!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.