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)
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?
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.
posted 5 years ago
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.
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.
posted 5 years ago
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.