What must be done before you can consume a web service?

Build a proxy library by using the wsdl.exe utility

Questions by mahathi_mani

Showing Answers 1 - 9 of 9 Answers

kingsalami

  • Jan 18th, 2008
 

1) First find a web service for example:
http:// www . nanonull . com/TimeService/TimeService . asmx

2) Create a web service proxy using the WSDL.exe in your
SDK folder like this:
WSDL http:// www . nanonull . com /TimeService/TimeService . asmx?WSDL

If you are successful you should see this:

Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:Program FilesMicrosoft Visual Studio 8SDKv2.0BinTimeService.cs'.

3)
Create a project in C# and add this file to your project.
4) Declare an instance of the class, for this one: TimeService and then you can start calling the functions in your proxy file (TimeService.cs).

  Was this answer useful?  Yes

kirangiet

  • Oct 20th, 2009
 

There are 2 ways one can consume a webservice.


1) By creating a proxy manually
2) By adding web reference


Creating Proxy manually:


1) Browse the webservice
2) Add ?wsdl at the end of the URL
3) Save the wsdl file in local system
4) Use visual studio command line utility type WSDL.exe
5) It will create a .cs file inside the same folder where wsdl file is present
6) Type csc /t:library
7) It will create a .dll file add the file in the reference and you are done
8) Now you can use the webservice like any other C# class.


Adding Web Reference:


1) Right click on the project select Add Web Reference
2) Type the URL of the webservice
3) Give the reference name and you are done


In case of creating proxy manually, when there is some addition or deletion
of new methods are happening we need to follow the same process each time. we
need not to create proxy if only implementation inside methods change because
our proxy does not contain implementation part. In case of using web service
through adding web reference we need to select web reference right click and
select update. It will update the proxy with latest changes.

adnobo007

  • Aug 2nd, 2012
 

One way is We must hard code to convert the request and response into SOAP format . Better way is to use wsdl.exe tool to build a proxy that will take care of conversion of response and request into SOAP format. We can build proxy by right clicking on solution and clicking on add web reference... option.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions