• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

When parameterStyle is Bare, web methods should only have 1 parameter

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


When I publish this using Endpoint.publish method, I got this error:

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: SEI hello.HelloWS has method sayHello annotated as BARE but it has more than one parameter bound to body. This is invalid. Please annotate the method with annotation: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
at com.sun.xml.internal.ws.model.RuntimeModeler.validateDocBare(RuntimeModeler.java:1247)
at com.sun.xml.internal.ws.model.RuntimeModeler.processDocBareMethod(RuntimeModeler.java:1236)
at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:609)
at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:401)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:240)
at com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:312)
at com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:178)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:456)
at com.sun.xml.internal.ws.api.server.WSEndpoint.create(WSEndpoint.java:475)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint(EndpointImpl.java:213)
at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:143)
at hello.Publisher.main(Publisher.java:12)


I wonder why there is a rule that only one parameter is allowed in the web method. SOAP body can have multiple children elements, but why only 1 parameter is allowed?
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@SOAPBinding is not allowed on SEI.
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The @SOAPBinding is defined in the SEI , it compiles. But the problem occurs when I used Endpoint.publish. It complains that two parameters are not allowed.
 
a sarkar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My bad, I was thinking about the javax.xml.ws.BindingType annotation. That's not allowed on the SEI.
You are not going to get a compilation error even if SOAPBinding were not allowed on the SEI (which it is). It's not a "syntax error" that the compiler will catch.

Anyway, I think I found the problem. Having multiple child elements is not WS-I BP 1.1 compliant. I don't know if you can force publishing of a non-compliant service.

R9981 An ENVELOPE MUST have exactly zero or one child elements of the soap:Body element.



http://www.ws-i.org/profiles/basicprofile-1.1.html
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, a SOAP envelop can only have 1 SOAP body. But inside a SOAP body, there still can be multiple children elements.
This should be a valid bare parameter style soap request:

So, why the BARE parameter style can only accept one parameter, but not two?
 
a sarkar
Ranch Hand
Posts: 93
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you misunderstood. Read it again.

An ENVELOPE MUST have exactly zero or one child elements of the soap:Body element.


As far as SOAP is concerned, having multiple child elements is valid. WS-I BP 1.1, however, says otherwise.
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well... I understand that an envelop must have at most one body element.
But how about the body element itself?
Can the body element itself have multiple children elements ? I would say Yes.





If a body is allowed to have multiple children, why the Endpoint cannot publish a web method with 2 parameters as the parameter style is defined as parameterStyle=BARE.
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer my own question, I am reading Ivan' notes p.73, it says "With document style web services, the BP mandates that each message have zero or one part."
He gives an example,

So, that means the parameters are all inside <sd:purchaseOrder> element in the SOAP request.

When the parameter style is wrapped, that makes sense to have all parameters wrapped inside <sd:purchaseOrder> element.
When the parameter style is bare, all parameters are not wrapped inside any element.
Therefore, that makes sense to have this under doc/lit/bare:

But that won't make sense to have this message under doc/lit/bare:

This is not valid as BP mandates that with document style web service, the message must have at most 1 <part> element.

Therefore, this web method won't be deployed:
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic