Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mixing document and RPC styles

 
a sarkar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wondering if document and RPC styles can both be used for an endpoint? The WSDL allows you to configure it for each operation using <soap colon operation style="rpc" />, so it looks theoretically possible, but wsimport complains that
Ignoring port "Calculator", its not WS-I BP 1.1 compliant: the wsdl binding has mixed style, it must be rpc-literal or document-literal operation. try running wsimport with -extension switch.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what I did. The sayHello method uses RPC while increment uses DOCUMENT.






When I use wsimport to generate the client, I got this: invalid wsdlperation "increment": its a rpc-literal operation, message part must be
refer to a schema type declaration
 
a sarkar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Himai Minh wrote:
When I use wsimport to generate the client, I got this: invalid wsdlperation "increment": its a rpc-literal operation, message part must be
refer to a schema type declaration

That error makes sense, because you declared RPC style on the class, wsimport thinks that every operation in the SIB is RPC style. If you move the style declaration from class level to 'sayHello' method, you might end up with an error similar to mine, although I started with the WSDL and not Java.
I'm curious how your service even got deployed. Are you able to view the WSDL after publishing it?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have answered here.

Regards,
Frits
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As suggested by Sarkar and Frit,
I want to illustrate this "implementations must report an error if Style.RPC is placed on a method.


The WSDL looks fine as its style is RPC.
<binding name="HelloPortBinding" type="tns:HelloWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="sayHello">
<soapperation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://hello/"/>
</input>
<output>
<soap:body use="literal" namespace="http://hello/"/>
</output>
</operation>
<operation name="increment">
<soapperation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>

But , when I use wsimport to generate artifacts, I got this error message:


But why the WSDL shows the style is RPC as sayHello method's SOAPBinding, but not DOCUMENT as the increment method?
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried one more example:


The WSDL:
<binding name="HelloPortBinding" type="tns:HelloWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soapperation soapAction=""/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
<operation name="increment">
<soapperation soapAction=""/><input>
<soap:body use="literal" namespace="http://hello/"/></input>
<output><soap:body use="literal" namespace="http://hello/"/></output>
</operation></binding>

By default, it is a DOCUMENT style. But the increment method is defined as RPC.

The wsimport generates this:
WSI-Basic Profile V.1.0 , namespace attribute not allowed in doc/lit for soapbinding:body: "increment".
Invalid wsdl: operation "increment" its a document-literal operation.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I swapped the order of the two methods:

The WSDL:
<binding name="HelloPortBinding" type="tns:HelloWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="increment">
<soapperation soapAction=""/><input>
<soap:body use="literal" namespace="http://hello/"/></input>
<output><soap:body use="literal" namespace="http://hello/"/></output>
</operation><operation name="sayHello"><soapperation soapAction=""/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
</binding>

The wsimport generates "invalid operations sayHello, its a RPC-literal.

It seems to me that if the first method is defined as RPC, but the second method is defined as a DOCUMENT, the publisher assumes the second method is RPC when WSDL is generated.
However, the second method is not RPC in this case. That is why the wsimport generates an invalid operation.
 
a sarkar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Himai,
Your examples are consistent with what I've come to understand. The WSDL fragments are especially helpful. Those show that the JAX-WS runtime is using the first @SOAPBinding annotation and applying it to all operations. I'd think that's to make it WS-I BP compliant which doesn't support operation level style anymore.
I think it's good that you've tried so many options and it helped us understand the topic better but I'm afraid those results don't prove much. What the JAX-WS runtime is supposed to do in this case isn't specified in the spec and that opens up any number of possibilities which the vendor might choose. The results that you found might be totally different in a different container and hence, they can't be considered conclusive.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic