NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Access UPS Webservices


Joined: 07 Sep 2007
Posts: 1
Location: New york
Reply with quote
hi i am trying to access UPS Shipping webservices ... by using nusoap but it always said "No Access and Authentication Credentials provided " here is my code

$lead=array();
$lead['Request']="";
$lead['TransactionReference']="";
$lead['ShipFrom']="";
$lead['Address']="";
$lead['City']="BethPage";
$lead['StateProvinceCode']="NY";
$lead['PostalCode']="11714";
$lead['ShipTo']="";
$lead['Address']="US";
$lead['City']="Flushing";
$lead['StateProvinceCode']="NY";
$lead['PostalCode']="11358";
$lead['Pickup']="";
$lead['Date']="20071028";
$lead['ShipmentWeight']="";
$lead['UnitOfMeasurement']="";
$lead['Code']="KGS";
$lead['Description']="Kilograms";
$lead['Weight']="10";
$lead['InvoiceLineTotal']="";
$lead['CurrencyCode']="USD";
$lead['MonetaryValue']="1000";
$lead['DocumentsOnlyIndicator']="";


$soapclient = new soapclient($soap_master_file); //define the SOAP Client and point to the SOAP Server
$soapclient->response_timeout = 60;
$soapclient->setHeaders("<Security> <UsernameToken> <Username>$username</Username> <Password>$password
</Password> </UsernameToken><UPSServiceAccessToken> <AccessLicenseNumber>
$accessKey </AccessLicenseNumber> </UPSServiceAccessToken></Security>");
$soapclient->setCredentials('$username','$password');

$result=$soapclient->call('GetRate', array('RateRequest'=>$lead),'','http://wwwcie.ups.com/webservices/RateBinding');

echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
View user's profileFind all posts by exsillentSend private messageMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 7901
Reply with quote
you may want to try to surround arguments in an extra array:
$result=$soapclient->call('GetRate', array(array('RateRequest'=>$lead)), ...
also you need to check the URL for the namespace. What you posted does not work.
finally, if $soap_master_file is a WSDL filename or URL, you have to provide 2nd argument in the soapclient constructor call. See samples in this forum.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Access UPS Webservices
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic