Wednesday, 14 December 2011

JAX-WS WSDL-Java mapping

Java Annotations WSDL Comments
package - definitions "targetNamespace" attribute -
interface or implementation class @WebService @SOAPBinding @BindingType (default SOAP 1.1/HTTP) portType "Service Endpoint Interface" (SEI). Supported SOAP binding styles = document/literal/wrapped (default), document/literal/bare, RPC/literal/(wrapped)
method (synchronous and asynchronous) @WebMethod @WebResult @RequestWrapper @ResponseWrapper operation Only one-way (with @OneWay) and request-response. Neither notification nor solicit-response. Thus, one input message and zero or one output message
request/response wrapper bean, parameter and return value types JAXB annotation types Mapped by JAXB. With "wrapped" parameter mapping style, request/response wrapper beans are generated so JAXB can generate the XSD used in WSDL. With them, developers have complete control over the generated WSDL. Default package is "jaxws"
method parameters @WebParam (override argN names) messages or message parts "wrapper" parameter mapping style tells that the root element of the message, also called "wrapper element" represents the name of the operation. Service parameters are mapped to the children of the root element (like rpc). The "non-wrapper" style does not make this assumption: the entire message is passed as unique service parameter. Out and in/out parameters are mapped to javax.xml.ws.Holder (with public "value" property)
method return value - single output message part, otherwise void With wrapper mapping, the children name must be unique or named "return"
exception @WebFault fault message Mapped fault message is available via getFaultInfo()
class extending Service @WebServiceClient service -
service class getter method @WebEndPoint port Getter returns a proxy thet implements the mapped SEI

Name collision avoidance:
  • "_Type" suffix (class)
  • "_Exception" suffix (Exception class)
  • "_Service" suffix (Service class)
  • "_" prefix (method name)