Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Mixing document and RPC styles

 
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.

 
Ranch Foreman
Posts: 1898
12
  • 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 wsdl:operation "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 wsdl:operation "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?
 
Creator of Enthuware JWS+ V6
Posts: 3343
303
Android Eclipse IDE Chrome
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have answered here.

Regards,
Frits
 
Himai Minh
Ranch Foreman
Posts: 1898
12
  • 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">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="http://hello/"/>;
</input>
<output>
<soap:body use="literal" namespace="http://hello/"/>;
</output>
</operation>
<operation name="increment">
<soap:operation 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 Foreman
Posts: 1898
12
  • 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">
<soap:operation soapAction=""/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
<operation name="increment">
<soap:operation 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 Foreman
Posts: 1898
12
  • 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">
<soap:operation soapAction=""/><input>
<soap:body use="literal" namespace="http://hello/"/></input>;
<output><soap:body use="literal" namespace="http://hello/"/></output>;
</operation><operation name="sayHello"><soap:operation 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.
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic