Shipping Integrator V5 - Online Help
Shipping Integrator V5
Questions / Feedback?

SubmitTo Method

Post current parameters to the URL specified by the 'URL' parameter.

Syntax

shiprequest.submitTo(URL, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

A post request is sent to the URL with the specified parameters and values. The response is given via the TransferredData property.

Following are examples of using the class to create a request for different services. Note that these examples show how to implement functionality existing in other classs. To use any of the functionality demonstrated here, you may use the corresponding class instead.

FedEx

Component.PostData = @"<?xml version="1.0" encoding="UTF-8" ?>" +
	@"<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">" +
	"<WebAuthenticationDetail>" +
	"<UserCredential>" +
	"<Key>MyKey</Key>" +
	"<Password>MyPassword</Password>" +
	"</UserCredential>" +
	"</WebAuthenticationDetail>" +
	"<ClientDetail>" +
	"<AccountNumber>000000000</AccountNumber>" +
	"<MeterNumber>000000000</MeterNumber>" +
	"<Localization>" +
	"<LanguageCode>en</LanguageCode>" +
	"<LocaleCode>en</LocaleCode>" +
	"</Localization>" +
	"</ClientDetail>" +
	...
	
Component.SubmitTo("https://gatewaybeta.fedex.com:443/xml");	
	
Component.XPath = "/ProcessShipmentReply/Notifications/Severity";
if(Component.XText == "SUCCESS")
	//The request was successful

UPS

Component.PostData = @"<?xml version="1.0"?>" +
	@"<AccessRequest xml:lang="en-US">" +
	"<AccessLicenseNumber>YourAccessLicenseNumber</AccessLicenseNumber>" +
	"<UserId>userid</UserId>" +
	"<Password>password</Password>" +
	"</AccessRequest>" +
	@"<?xml version=\"1.0\"?>" +
	@"<VoidShipmentRequest xml:lang=\"en-US\">" +
	...
	
Component.SubmitTo("https://wwwcie.ups.com/ups.app/xml/Void");

Component.XPath = "/VoidShipmentResponse/Response/ResponseStatusCode";
if(Component.XText == "1")
	//The request was successful

USPS With Endicia

Component.PostData = "postageRateRequestXML=<PostageRateRequest>" +
	"<RequesterID>test</RequesterID>" +
	"<CertifiedIntermediary>" +
	"<AccountID>123456</AccountID>" +
	"<PassPhrase>test</PassPhrase>" +
	"</CertifiedIntermediary>" +
	"<MailClass>ExpressMailInternational</MailClass>" +
	"<WeightOz>1</WeightOz>" +
	"<MailpieceShape>FlatRateEnvelope</MailpieceShape>" +
	"<AutomationRate>FALSE</AutomationRate>" +
	"<Machinable>TRUE</Machinable>" +
	"<Services>" +
	"<InsuredMail>OFF</InsuredMail>" +
	"</Services>" +
	"<FromPostalCode>10022</FromPostalCode>" +
	"<ToCountry>Algeria</ToCountry>" +
	"</PostageRateRequest>";
	
Component.ContentType = "application/x-www-form-urlencoded";
Component.SubmitTo("https://www.envmgr.com/LabelService/EwsLabelService.asmx/CalculatePostageRateXML");

Component.XPath = "/PostageRateResponse/Status";
if(Component.XText == "0")
	//The request was successful

USPS

Component.AddParameter("XML",@"<CarrierPickupCancelRequest USERID="User" PASSWORD="Pass"><FirmName>ABC Corp.</FirmName>" +
               "<SuiteOrApt>Suite 777</SuiteOrApt>" +
               "<Address2>1390 Market Street</Address2>" +
               "<Urbanization></Urbanization>" +
               "<City>Houston</City>" +
               "<State>TX</State>" +
               "<ZIP5>77058</ZIP5>" +
               "<ZIP4>1234</ZIP4>" +
               "<ConfirmationNumber>WTC123456789</ConfirmationNumber>" +
               "</CarrierPickupCancelRequest>");
               
Component.AddParameter("API", "CarrierPickupCancel");
Component.ContentType = "application/x-www-form-urlencoded";
Component.SubmitTo("https://secure.shippingapis.com/ShippingAPITest.dll");

Component.XPath = "/CarrierPickupCancelResponse/Status";
Console.WriteLine(Component.XText);

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 5.0.6240.0