Use of style attribute in soap:binding versus soap:operation
anil.saldhana Nov 4, 2005 5:45 PMTitle: Service Proxy construction assumes the wrong style (rpc) when .Net specifies document style
Lets discuss this.....
The code is ServiceDescription.java
private void initServiceStyle() { Iterator itBinding = wsdlBinding.getExtensibilityElements().iterator(); while (itBinding.hasNext()) { ExtensibilityElement exElement = (ExtensibilityElement)itBinding.next(); if (exElement instanceof SOAPBinding) { SOAPBinding soapBinding = (SOAPBinding)exElement; Style bindingStyle = Style.getStyle(soapBinding.getStyle()); if (style == null && bindingStyle != null) style = bindingStyle; if (style != null && bindingStyle != null && style.equals(bindingStyle) == false) throw new IllegalArgumentException("Unsupported mix of style attributes " + style + "/" + bindingStyle); } } if (style == null) { log.warn("Cannot find any style attribute for binding: " + wsdlBinding.getQName()); style = Style.RPC; } }
.Net can define a binding as follows:
<wsdl:binding name="BasicHttpBinding_IBaseDataTypesDocLitB" type="tns:IBaseDataTypesDocLitB"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> - <wsdl:operation name="RetBool"> <soap:operation soapAction="http://tempuri.org/IBaseDataTypesDocLitB/RetBool" style="document" /> - <wsdl:input name="RetBool_RequestMessage_Body"> <soap:body use="literal" /> </wsdl:input> - <wsdl:output name="RetBool_ResponseMessage_Body"> <soap:body use="literal" /> </wsdl:output> </wsdl:operation>
As you can see the style is not defined on soap:binding but on soap:operation underneath.
If you look at an example wsdl generated by wscompile, you will see:
<binding name="JaxRpcTestServiceBinding" type="tns:JaxRpcTestService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/> <operation name="echoSimpleUserType"> <soap:operation soapAction=""/> <input> <soap:body use="literal" namespace="http://org.jboss.ws/jaxrpc"/> </input> <output> <soap:body use="literal" namespace="http://org.jboss.ws/jaxrpc"/> </output> </operation>
Here the style is defined on the soap:binding rather than on soap:operation.
WSDL 1.1 (http://www.w3.org/TR/wsdl#_soap:binding)
=============================================
<definitions .... > <binding .... > <soap:binding transport="uri"? style="rpc|document"?> </binding> </definitions> The value of the style attribute is the default for the style attribute for each contained operation. If the style attribute is omitted, it is assumed to be "document".
***We assume it to be "rpc"***
<definitions .... > <binding .... > <operation .... > <soap:operation soapAction="uri"? style="rpc|document"?>? </operation> </binding> </definitions> The style attribute indicates whether the operation is RPC-oriented (messages containing parameters and return values) or document-oriented (message containing document(s)). This information may be used to select an appropriate programming model. The value of this attribute also affects the way in which the Body of the SOAP message is constructed, as explained in Section 3.5 below. If the attribute is not specified, it defaults to the value specified in the soap:binding element. If the soap:binding element does not specify a style, it is assumed to be "document".
lets look at the BP 1.0 final
5.6 SOAP Binding 5.6.3 Consistency of style Attribute The style, "document" or "rpc", of an interaction is specified at the wsdl:operation level, permitting wsdl:bindings whose wsdl:operations have different styles. This has led to interoperability problems. R2705 A wsdl:binding in a DESCRIPTION MUST use either be a rpc-literal binding or a document-literal binding.
So I am guessing that the .Net wsdl is not really BP-1.0 compliant. Is this true?