Different programming environments use different tools to generate proxy classes from a given WSDL. In .Net we have wsdl.exe; with Axis we have WSDL2Java utility. They use their own way of creating proxies. It doesn’t matter what ever the namespace you have for your classes [eg. ABC.Foo] at the service end, a different namespace will be generated for the proxy at the client side, depending on the tool you are using. For example in .Net if you add a web reference [with the name REF] from your project XYZ, then the generated namespace for your proxy class [Foo], will be XYZ.REF.Foo.
In WSDL2Java, it will use the target namespace of the service to generate proxies.
So... why bother..? But there are situations where you need to have the same class structure in the client side as in the service end. Especially when you are the middle man. Otherwise it requires an expensive mapping between objects. There is a solution... and I’ll come to it after discussing the second issue as well.
There are situations where you need to make generated proxies Serializable at the client side. That is, we need to add the attribute [Serializable]. This can be manually done if we have a small set of classes. But we need to repeat the same thing again & again every time we refresh the web reference.
Following is the solution for both the above issues.
Download the WsContractFirst Visual Studio .NET add-in from http://www.xmlwebservices.cc/weblog/WsContractFirstSetup03.zip .
After the installation right click on the .Net project where you need to add the web reference and select “Choose WSDL to implement…”. Other steps are self explanatory.

No comments:
Post a Comment