example This is the web reference URL of DHL SERVICE
http://service.ecocoma.com/shipping/dhl.asmx[
^]
in your solution click add web reference
one window opens enter URL and press "GO"
give your own name to the reference you add.
I gave "DHLService" as name
then in code behind
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
CalulateShippingPrice();
}
catch (Exception ex)
{
}
}
}
private void CalulateShippingPrice()
{
DHLService.Shipping ShippingRate = new DHLService.Shipping();
DHLService.Shipping ExtendedShippingRate = new DHLService.Shipping();
DHLService.Options DHlOptions = new DHLService.Options();
try
{
string KeyID = string.Empty;
string DomainID = string.Empty;
string SenderAddress = string.Empty;
string SenderCity = string.Empty;
string SenderState = string.Empty;
string SenderPostalCode = string.Empty;
string SenderCountry = string.Empty;
string ReceiverCity = string.Empty;
string ReceiverState = string.Empty;
string ReceiverPostalCode = string.Empty;
string ReceiverCountry = string.Empty;
string Weight = string.Empty;
string ProtectionValue = string.Empty;
DHlOptions.ShipDate = string.Empty;
DHlOptions.ShipmentType1 = string.Empty;
DHlOptions.ShipmentType2 = string.Empty;
DHlOptions.Length = string.Empty;
DHlOptions.Width = string.Empty;
DHlOptions.Height = string.Empty;
DHlOptions.AdditionalProtectionCode = string.Empty;
DHlOptions.SpecialService = string.Empty;
DHlOptions.CODPaymentCode = string.Empty;
DHlOptions.CODPaymentValue = string.Empty;
DHlOptions.OverrideCode = string.Empty;
DHlOptions.TransactionTrace = string.Empty;
DHlOptions.ContentDesc = string.Empty;
DHlOptions.DutiableFlag = string.Empty;
DHlOptions.CustomsValue = string.Empty;
DHlOptions.Mode = string.Empty;
DHlOptions.Sort = string.Empty;
using (DHLService.DHL_Service DHLObj = new DHLService.DHL_Service())
{
ShippingRate = DHLObj.GetDHLRate(KeyID, DomainID, SenderAddress, SenderCity, SenderState, SenderPostalCode, SenderCountry, ReceiverCity, ReceiverState, ReceiverPostalCode, ReceiverCountry, Weight, ProtectionValue);
ExtendedShippingRate = DHLObj.GetExtendedDHLRate(KeyID, DomainID, SenderAddress, SenderCity, SenderState, SenderPostalCode, SenderCountry, ReceiverCity, ReceiverState, ReceiverPostalCode, ReceiverCountry, Weight, ProtectionValue, DHlOptions);
}
}
catch (Exception ex)
{
}
}