views:

64

answers:

2

Disclaimer: My experience/knowledge of web services is very limited.

There is an existing web service WSDL that I have reverse engineered with wsdl.exe to create a C# proxy class.

Using Visual Studio 2008 I created a default web service template.

How do I reference the generated proxy class so that it will work in the web service?

For example -> calling http://localhost/webservice/service.asmx?WSDL will return the details from the proxy class.

+2  A: 

First of all, you should not be using ASMX web services. Microsoft now considers them to be "legacy technology", and suggests that all new development of web service clients or services be done using WCF. Don't start off at a disadvantage.

Secondly, the normal way to make use of a WSDL is to use the "Add Web Reference" command in Visual Studio ("Add Service Reference" if you were using WCF). This generates the proxy classes for you and adds them to your project.

I'm not sure from your question that this is what you want, since you first talk about the WSDL, but then talk about a "default web service template". What do you mean to do with the "default web service template"?


Try using the svcutil.exe program (not WSDL.EXE) as follows:

svcutil YourWsdl.WSDL /language:C# /d:subdirectory

This should produce a number of files in the subdirectory. Take a look at the .cs files, one of which will contain an interface which is the service contract. That is the interface that your service must implement. Look at your "default" WCF service application and you'll see that it does the same thing - produces an interface that is implemented by the service.

John Saunders
@John Saunders - following your advice I have create a WCF service project and then added the web reference. What other basic steps are needed to utilize the newly added web reference?
John M
@John: I'm still not clear on what you're trying to do. Are you trying to create a web service that can call another web service?
John Saunders
@John Saunders - I am trying to recreate an existing web service that I don't have the source code for. The web service receives XML messages and then saves them into a folder on the receiving folder. I'm primarily just trying to figure out what elements are needed to create a web service.
John M
@John: Ok, that's the confusion. A WSDL is usually used to create a Web Service _client_, not to create a service.
John Saunders
A: 

Please take a look at How to use a WSDL File to create a WCF Proxy? thread.

adatapost