Java Reference
In-Depth Information
pointer, thus enabling a method to return more than just one result. If the mode is either
OUT
or
INOUT
, it must be of the Holder type
javax.xml.ws.Holder<T>
. Further
discussion of the Holder type is outside the scope of this topic; for more details consult the
JAX-WS specification.
The
header
property determines whether the parameter is pulled from the header of the
message or the body. Setting the property to
true
means the parameter is pulled from the
header. This is used in situations where an intermediary needs to do something with the
SOAP message before passing it on, like routing it to the correct server. Intermediaries only
examine the contents of the header. Setting the
header
to
true
generates the following
WSDL:
<operation name = "addNewBid">
<soap:operation soapAction="urn:NewBid"/>
<input>
<soap:header message="tns:PlaceBid_addNewBid" part="user" use="literal"/>
<soap:body use="literal" parts="parameters"/>
</input>
</operation>
The
partName
property controls the generated
name
element of the
wsdl:part
or the
XML schema element of the parameter, if the web service binding style is RPC, or if the
binding style is document and the parameter style is
BARE
. If
name
isn't specified for an
RPC-style web service and the
partName
is specified, the server will use the
partName
to generate the name of the element.
Using the @WebResult annotation
The
@WebResult
annotation is very similar to the
@WebParam
annotation. It operates in
conjunction with the
@WebMethod
to control the generated name for the message return
value in the WSDL, as illustrated here:
@WebMethod
@WebResult(name="bidNumber"
public Long addBid(...) {}
The
@WebResult
annotation specification resembles the
@WebParam
annotation minus
support for the mode:
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = {ElementType.METHOD})