Tuesday, August 12, 2008

Using WseWSDL3.exe to generate proxy class for Visual Studio 2008

Our development environment includes a web service MOM that uses WSE 3.0 to provide security, but I discovered from the MSDN forums that Visual Studio 2008 does not have built-in support for WSE like 2005 did. There are a couple of different workarounds, but the cleanest approach seems to be using the WSDL to Proxy Class Tool (wsewsdl3.exe) included with the WSE 3.0 tools – default location: C:\Program Files\Microsoft WSE\v3.0\Tools

I used the following command to generate a proxy class from a WSDL file in the same directory (you can also pass a URL):

wsewsdl3 MyService.wsdl /language:VB /namespace:MyCoolSvc /type:webClient

The /type specifies which class to inherit from. Check out the MSDN documentation for additional details.

Note, that our environment uses a CustomPolicyAssertion to authenticate the request:

Dim cpa As New MyCompany.Web.Services.CustomPolicyAssertion

Dim p As New Microsoft.Web.Services3.Design.Policy

Dim wscp As New Microsoft.Web.Services3.WebServicesClientProtocol



wscp.RequestSoapContext.Add("StdUser", "MyApp")

No comments: