views:

496

answers:

2

I am trying to add a web reference to an ASP.NET 2.0 application in Visual Studio 2008.

However, the generated proxy classes do not include BeginXXXX and EndXXXX methods.

How can I get these to be generated? Do I need to manually use wsdl.exe?

(Incidentally in ASP.NET 3.5 apps, there is an option in the Add Service Reference box which lets me specify that Async methods should be generated. However, I am limited to ASP.NET 2.0 implementation).

A: 

Web services from 2.0 on generate different ASync methods through event handlers. The Begin/End methods shouldn't actually be necessary to complete an ASync proxy: http://www.codeguru.com/csharp/csharp/cs_webservices/security/article.php/c9179__1/

However, these methods auto-generate in the GUI. The nature of the web service should provide the interface with these methods through the metadata of the SoapHttpClientProtocol object.

If you write the service instantiation code in a file, you should be able to right-click the variable's type declaration and choose "Go To Definition". This will take you to the metadata generated when you added the service.

Joel Etherton
+1  A: 

If you use Visual Studio's 2008 Add Web Reference GUI it will not generate BeginXXX and EndXXX methods. You might need to directly call wsdl.exe (from the Visual Studio 2008 Command Prompt):

wsdl.exe http://www.example.com/someservice.asmx?wsdl

and include the resulting .cs file containing the proxy classes and the corresponding BeginXXX and EndXXX methods to your project.

Note: wsdl.exe might be located at C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin

Darin Dimitrov