?
Solved

WSDL intergation

Posted on 2014-03-27
5
Medium Priority
?
428 Views
Last Modified: 2014-05-29
Hi guy

i need some help getting the total cost of delivery from the below WSDL

http://ws.aramex.net/shippingapi/ratecalculator/service_1_0.svc 

please can you asisted with helping me code in c# to connect to this web server and get the total cost.

i am totally lost and do not know what to do.

i have spoken to the campany and they gave me the below feedback which does not help:

1.      The sample code at aramex.com covers ASP.net C# and PHP only .
2.      For you reference I have attached the WSDL file as well
3.      The WSDL you need to reference is http://ws.aramex.net/shippingapi/ratecalculator/service_1_0.svc
0
Comment
Question by:JCWEBHOST
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39960092
In your project right-click on "References" and choose "Add Service Reference". Paste that URL into the "Address" field and click "Go". Visual Studio should then interrogate the service and generate a proxy class that you can use to talk to the service.

The you need something like the following to call it:
            ServiceReference1.Service_1_0Client client = new ServiceReference1.Service_1_0Client();
            ServiceReference1.RateCalculatorRequest request = new ServiceReference1.RateCalculatorRequest();

            ServiceReference1.ClientInfo clientInfo = new ServiceReference1.ClientInfo();
            ServiceReference1.Transaction transaction = new ServiceReference1.Transaction();
            ServiceReference1.Address originAddress = new ServiceReference1.Address();
            ServiceReference1.Address destinationAddress = new ServiceReference1.Address();
            ServiceReference1.ShipmentDetails shipmentDetails = new ServiceReference1.ShipmentDetails();

            /* Populate all of the objects created above */

            ServiceReference1.Money totalAmount;
            bool hasErrors;

            // send request to service
            client.CalculateRate(
                clientInfo,
                ref transaction,
                originAddress,
                destinationAddress,
                shipmentDetails,
                out hasErrors,
                out totalAmount
            );

            client.Close();

Open in new window

0
 

Accepted Solution

by:
JCWEBHOST earned 0 total points
ID: 39963382
Hi Sorry

i went far thanks just suck getting the value back, please see code below:

        ServiceReference1.Service_1_0Client client = new ServiceReference1.Service_1_0Client();
        ServiceReference1.RateCalculatorRequest request = new ServiceReference1.RateCalculatorRequest();

        ServiceReference1.ClientInfo clientInfo = new ServiceReference1.ClientInfo();
        ServiceReference1.Transaction transaction = new ServiceReference1.Transaction();
        ServiceReference1.Address originAddress = new ServiceReference1.Address();
        ServiceReference1.Address destinationAddress = new ServiceReference1.Address();
        ServiceReference1.ShipmentDetails shipmentDetails = new ServiceReference1.ShipmentDetails();
        ServiceReference1.Weight shipmentWeight = new ServiceReference1.Weight();

        /* Populate all of the objects created above */

        clientInfo.AccountCountryCode = string.Empty;
        clientInfo.AccountEntity = string.Empty;
        clientInfo.AccountNumber = string.Empty;
        clientInfo.AccountPin = string.Empty;
        clientInfo.UserName = "reem@reem.com";
        clientInfo.Password = "123456789";
        clientInfo.Version = "v1.0";

        transaction.Reference1 = "001";

        originAddress.City = "Dubai";
        originAddress.CountryCode = "AE";

        destinationAddress.PostCode = "SL1 0NS";
        destinationAddress.CountryCode = "GB";

        shipmentDetails.ProductGroup = "EXP";
        shipmentDetails.ProductType = "PDX";
        shipmentDetails.PaymentType = "P";

        shipmentDetails.ActualWeight = new ServiceReference1.Weight();
        shipmentDetails.ActualWeight.Value = 00.5;
        shipmentDetails.ActualWeight.Unit = "KG";

        shipmentDetails.ChargeableWeight = new ServiceReference1.Weight();
        shipmentDetails.ChargeableWeight.Value = Convert.ToDouble(5);
        shipmentDetails.ChargeableWeight.Unit = "LB";

        ServiceReference1.Money totalAmount;
        bool hasErrors;

        // send request to service

        client.CalculateRate(clientInfo, ref transaction, originAddress, destinationAddress, shipmentDetails, out hasErrors, out totalAmount);

        client.Close();
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39963700
Having played around with your code, i think you are just missing the "NumberOfPieces" value from the shipping details:
shipmentDetails.NumberOfPieces = 1;

Open in new window

0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40088211
If my comment was the solution, or at least assisted in finding a solution then you should really accept that as the answer, rather than your own comment.
0
 

Author Closing Comment

by:JCWEBHOST
ID: 40097759
works fine
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question