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 Saldanha Master

      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:output name="RetBool_ResponseMessage_Body">
       <soap:body use="literal" />

      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=""/>
       <soap:body use="literal" namespace="http://org.jboss.ws/jaxrpc"/>
       <soap:body use="literal" namespace="http://org.jboss.ws/jaxrpc"/>

      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"?>
      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"?>?
      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
          Scott Stark Master

          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 Saldanha Master

            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 Saldanha Master

              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
              Hope this helps.

              • 4. Re: Use of style attribute in soap:binding versus soap:opera
                Scott Stark Master

                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.


                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 Master

                  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.

                   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();
                   // 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;
                   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?