By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,402 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,402 IT Pros & Developers. It's quick & easy.

How to add style="document" attribute in .Net 2.0 wsdl

P: n/a
When .Net 1.0 webservice (VS2003) generates a wsdl -

<wsdl:binding name="TestSoap" type="tns:TestSoap">
<soap:binding transport=""
style="document"/(note: style attribute present)
<wsdl:operation name="HelloWorld">
<soap:operation soapAction=""
style="document" />

But when .Net 2.0 webservice (VS2005) generates a wsdl -

<wsdl:binding name="TestSoap" type="tns:TestSoap">
<soap:binding transport="" /(note:
style attribute missing)
<wsdl:operation name="HelloWorld">
<soap:operation soapAction=""
style="document" />

so the new VS2005 webservice wsdl omits the style="document" attribute. The
style is however "document" by default.

The problem that this causes is - Java specifically requires the
style="document" when it consumes a .Net Webservice.

And we do not want our Java users to make any change on their side. All our
webservices are currently in VS2003 and want to convert to VS2005, but want
this change to be transparant to Java users.

I found that in .Net2.0 using SoapExtensionReflector you can intercept the
wsdl, the wsdl/servicedescription is accessible via a object model - a
ServiceDescription class and through one of it's collection which is the
BindingCollection (of the SoapExtension collection) you can set the style to
either "document" or "RPC"

When I set it to RPC it does add the style="RPC" attribute. But when I set
style to document it still omits the style="document"
NOTE: style is a enumerated type. here is my code below.

ServiceDescription myDescription =

BindingCollection myBindingCollection = myDescription.Bindings;
SoapBinding sb =
sb.Style = SoapBindingStyle.Document; //does not add
style="document" attribute

sb.Style = SoapBindingStyle.Rpc; //does add style="rpc" attribute

Any clues ?? No, we don't want to manually create the wsdl. We want a
solution that will not break Java code. Other than the missing style
attribute the rest of the wsdl looks similar to the one created by VS2003.
May 5 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.