Link to home
Start Free TrialLog in
Avatar of Mortarello
MortarelloFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Calling WebService from WCF c#

Hello Guys,

I'm trying to create a Custom Binding to call a WebService using ISO8859 with out success.

Does any one could help me please ?

I found some code on internet but did not work.

Many Thanks,

Michel
Avatar of kaufmed
kaufmed
Flag of United States of America image

Do you have a WSDL file for the service?
Avatar of Mortarello

ASKER

Hi  kaufmed,

Thanks to your answer...Yes I download some code to add a acustomer binding but without sucess.

Is it possible if I send the projecto to you ? ..There is only one form and I'm traying to consume the Web Service using Iso-8859

Thansk man
If it's not sensitive information, then you are welcome to post it.
Avatar of Vel Eous
Vel Eous

You can use the svcutil.exe app to create a client proxy:

Accessing Services Using a WCF Client
Hi kaufmed,

You can download my project from here..

http://www.mediafire.com/?nn2idh90wr0vez4

Kaufmed, you will see 3 buttons

Addressing --- is working fine ..
Shippiment -- Requires ISO
tracking      --- Requires ISO

Thanks man
I won't be able to look at that as my office's proxy blocks MediaFire (and probably most/all of the download sites). You should be able to post the project here. IIRC, you need to remove the bin and obj folders, and the .suo file in the root. When you try to upload the zip, EE will tell you if there are any other offending files.

Outside of that, you can wait to see if someone else pops in who can access the zip you posted. Otherwise, I can review it later tonight when I am home.
Hi Kaufmed,

Thanks to try to help me. The zip file is only 172KB and I'm getting erro to attach the file.

The WSDL is ( http://demo.despatchbay.com/api/soap/v11/shipping?wsdl )

On the Config file I had added ..

  <appSettings>
    <add key="user"      value="1-AZO67F52" />
    <add key="password"  value="VR1TXCG" />
  </appSettings>


This is my method call.
-------------------------------------------------------------------------------------------------------------------------------------
var SP = new ShippingService.ShippingServicePortTypeClient();

            var u = ConfigurationManager.AppSettings["user"];
            var p = ConfigurationManager.AppSettings["password"];

            SP.ClientCredentials.UserName.UserName = u;
            SP.ClientCredentials.UserName.Password = p;

            // should make a call to GEtDomesticServicesByPosteCode method to check availibility before adding a shippment.

            try
            {
                var temp = SP.GetDomesticServicesByPostcode("ha8 7td");
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Exception Message : {0}",ex.Message));
            }

-------------------------------------------
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
P.S.

You can ignore/remove line 3. I forgot to erase it, and it was for something I was trying in the WDF version I attempted.
Hi Kaufmed,

Many  thanks Kaufmed for your help..

Could you tell me how did you created that proxy class. I have to do the tracking too.

Tks
Open a Visual Studio Command Prompt (Start->Programs->MS Visual Studio 2008/2010->Visual Studio Tools->VS Command Prompt). Navigate to the folder where you want to place the output file. Enter the following command:

wsdl.exe /namespace:ShippingService /protocol:SOAP http://demo.despatchbay.co m/api/soap /v11/shipp ing?wsdl

This will dump out a .cs file containing the proxy class(es), all housed in a namespace called "ShippingService". The default name of the file will be the name of the service appended with ".cs". If you need to change the name of the file, you can pass the "/out" parameter:

wsdl.exe ... /out:newname.cs ...

I am behind a proxy, so in order to create the class using the URL, I had to enter my login details for my proxy. To do this you can use the "/proxy", "/proxyusername", and "/proxypassword" options to specify those details:

wsdl.exe ... /proxy:www.example.com /proxyusername:user /proxypassword:password ...

Alternatively, you can just download the WSDL file locally and use the path to the local file rather than download it from the URL. If you do this, you won't need to worry about any proxy information.
P.S.

The code file you create with this utility won't be added by default to your project, so you will need to "Add Existing Item" this file to your project in order to be able to use it.