The less nice part is that there is no such support for Visual Studio 2008 as Microsoft is encouraging us to use WCF instead. Which is a good idea generally, but not alway feasible: The reality is that a lot of the WSE3 & VS 2005 projects were migrated to VS2008 and lack this fundemental support. Also a lot of new projects need compatability with WSE3 which is not always possible with WCF.
So how WSE3 can work with VS2008?
The truth is that the WSE run time is agnostic to the IDE version. IOW projects built with VS 2008 can use WSE3 in run time in the same way as VS 2005 projects. This means we are left with the tiny mission of actually developing these projects. Well, not so tiny but also not too hard. We have two options for our needs:
Option 1 - Trainer Wheels
We need to remember that configuring WSE infrastructure is mostly a one-time mission - we do not frequently alter it during development. So we can create a VS2005 project with WSE3 and migrate it to VS2008 as is using the VS migration wizard. Usually we would never need to look at the WSE configuration until late stages. Then we can open our VS2005 project, change what we want from UI, and notice that such changes only affect this section of our web.config/app.config:
So we can copy&paste this part to our new project. In case we use a .policy file we can copy all of its contents to the new project. If this looks lame it's only because VS 2005 is strictly a trainer wheel here, we do not actually need it. For this we have:
Option 2 - Just 2008, Please
We can directly use WSE3 with VS2008 in the following way:
1. In our project, add assembly reference to "Microsoft.Web.Services3.dll" (it's in the GAC and also in %Program Files%\Microsoft WSE\v3.0)
2. If we are creating the client side we would like to use "add web reference". This is not available but luckily we have the option to use %Program Files%\Microsoft WSE\v3.0\Tools\WseWsdl3.exe:
This will create our proxy .cs file which we can add to our project. The file looks like this:
So in our code we can create a new instance of this class and call the service:
For the service side we can just create a new normal web service project, nothing special.
3. We can now use the WseConfigEditor3.exe tool that comes with the WSE3 SDK to edit our app.config/web.config and even add a policy file. Then in our client code we can tell the proxy to use this policy:
This is the same we would do with VS 2005 so no news here.
If we are on the server side we need to check both "Enable this project for Web Services Enhancements" and "Enable Microsoft Web Services Enhancements Soap Protocol Factory" in the configuration editor:
Pretty easy after all... What's next? get this blog rss updates or register for mail updates!
2 comments:
In vs2008, webproject, 2nd option "Enable Microsoft Web Services Enhancements Soap Protocol Factory" is always disable. In case of vs2008, website it is enable and we can check/uncheck it.
I have also tried the Start-> All Programs-> Microsoft WSE 3.0-> Configuration Tool and then loading with the web.config file of my project but unable to create instance of object xxxWse class. as it is not creating class xxxWse in the reference.cs until 2nd option is checked i.e
Enable Microsoft Web Services Enhancements Soap Protocol Factory = checked
Thanks Anil, I did not know that
Post a Comment