Using WSE 3.0 with Visual Studio 2008 and .NET 3.5
Tags:While I'm sure many of you have "moved on" to Visual Studio 2010, there are a large number of us still using 2008. Recently, my shop needed to write some code for interfacing with a vendor's web services. No problem, right? Well… not quite. It was quite an undertaking to get a functional wrapper class for our vendor's web service shoehorned into Visual Studio 2008 and the .NET 3.5 platform.
Enabling the WSE Settings GUI tool in VS2008
- First, download and install the WSE 3.0 for Microsoft .NET package
- Now, change each instance of 8.0 to 9.0 in the WSESettingsVS3.Addin file, which should be located here:
C:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\Addins\WSESettingsVS3.Addin
- In Visual Studio, open the Tools » Options dialog.
- Be sure that the Show all settings checkbox is checked.
- In the Options dialog, select Environment » Add-in/Macros Security and add the following path to the Add-in File Paths list:
C:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\Addins
- From the main Visual Studio interface, open the Tools » Add-in Manager dialog.
- Enable the WSE Settings Add-in.
- Restart Visual Studio.
- In your project, right-click the top-most node in the Solution Explorer window and select WSE Settings 3.0.
- Configure the WSE settings for your project—this will add the necessary references and
Web.config
directives. - [OPTIONAL] If you will be using an authentication mechanism which relies on a UsernameToken, be sure to set up a UsernameToken Provider</i.>Security Tokens Managers section of the Security tab of the WSE settings.
Generating a WSE proxy class from a WSDL list
- Download and install the .NET Framework 2.0 SDK (x86), which is necessary for creating the WebClient-type proxy/wrapper class
- Use the
WseWsdl3.exe
tool with the/type:webClient
switch to generate a WebClient-based proxy class for your web service:"c:\Program Files\Microsoft WSE\v3.0\Tools\WseWsdl3.exe" /nologo /type:webClient /out:c:\ProjectFolder\MyWebService.cs http://addres.of/my/webservice?wsdl
- Add the generated
*.cs
file to your project'sApp_Code
directory.
Note: You may use WseWsdl3.exe
without the .NET 2.0 SDK, but it will only be able to generate SoapClient-based proxy classes (which are difficult to integrate with a UsernameToken authentication header). In this case, you may omit the /type:
flag altogether, as SoapClient is the default proxy class type.
Posted: