5 Replies Latest reply on Nov 6, 2005 6:36 PM by thomas.diesler

    Use of style attribute in soap:binding versus soap:operation

    anil.saldhana

      Title: 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?

        • 1. Re: Use of style attribute in soap:binding versus soap:opera
          starksm64

          Yes, that is how I read the spec. It would have been clearer if they also said the style must not be specified on the operation element. What version of .NET is this?

          • 2. Re: Use of style attribute in soap:binding versus soap:opera
            anil.saldhana

            This is a gray area between wsdl 1.1 specification and WS-I BP 1.0

            BP 1.0 mandates the style attribute on the soap:binding element

            This is with Indigo.

            • 3. Re: Use of style attribute in soap:binding versus soap:opera
              anil.saldhana

              You may want to take this discussion as far as it goes.

              Here is Microsoft reply to this:

              Hey Anil,
              
              Neither BP1.1 nor 1.0 nor WSDL1.1 spec require explicit presence of
              soap:binding/@style attribute.
              
              The default value of this attribute is document. It is an error to
              assume rpc.
              
              The requirement you are citing in the post says it BP-compliant service
              must have the same style for all operations within the same binding.
              
              In section 4.4 of BP1.1 [1], definition of document style, the bindings
              with omission of @style attribute on soap:binding element are explicitly
              allowed.
              
              Hope this helps.
              [1]
              http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#WSDLMSGS
              
              


              • 4. Re: Use of style attribute in soap:binding versus soap:opera
                starksm64

                5.3 of the BP 1.0 profile says the same thing about a style attribute not being required on the binding element. I just said it would be clearer if the spec required the style be specified on the binding element, I don't know that we require it. So in general it appears you need to allow for the laxest implementation that conforms with the Rnnnn statements. It will be good to work on interop with MS since they sit on the BP spec committees.

                http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html


                A "document-literal operation" is a wsdl:operation child element of wsdl:binding each of whose soapbind:body descendent elements specifies the use attribute with the value "literal" and each of which either:

                1. Specifies the style attribute with the value "document"; or
                2. Is the child of a soapbind:binding element which specifies the style attribute with the value "document", and does not itself have the style attribute specified; or
                3. Is the child of a soapbind:binding element which does not have the style attribute specified, and does not itself have the style attribute specified.



                • 5. Re: Use of style attribute in soap:binding versus soap:opera
                  thomas.diesler

                  Yes, it is a bug in 4.0.x. The default should be document, which is also in line with JSR-181 @SOAPBinding.style

                  The new stack should handle the style attributes correctly when the unified meta data model (UMDM) is build. It also defaults to document.

                  
                  WSDL11Reader:618
                  
                   String bindingStyle = Style.getDefaultStyle().toString();
                   List extList = srcBinding.getExtensibilityElements();
                   for (int i = 0; i < extList.size(); i++)
                   {
                   Object extElement = extList.get(i);
                   if (extElement instanceof SOAPBinding)
                   {
                   SOAPBinding soapBinding = (SOAPBinding)extElement;
                   bindingStyle = soapBinding.getStyle();
                   }
                   }
                  
                  WSDL11Reader:671
                  
                   // Process soap:operation@soapAction, soap:operation@style
                   String operationStyle = null;
                   Iterator itExt = srcBindingOperation.getExtensibilityElements().iterator();
                   while (itExt.hasNext())
                   {
                   ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
                   if (extEl instanceof SOAPOperation)
                   {
                   SOAPOperation soapOp = (SOAPOperation)extEl;
                   destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
                   operationStyle = soapOp.getStyle();
                   }
                   }
                   destIntfOperation.setStyle(operationStyle != null ? operationStyle : bindingStyle);
                  
                  


                  Anil, why is the 4.0.x code base relevant for MS web service interop tests?