A typical WSDL document consists of the following elements: "types," "message," and "portType" for the abstract definitions; "binding" and "service" for the concrete specification.
In the context of RPC and document style, it is the binding element which describes how the service is bound to a messaging protocol, either HTTP GET/POST, MIME, or SOAP. In practice, SOAP is the most universally used protocol; it is SOAP that the RPC/document distinction refers to. Usually HTTP(S) is used as transport protocol for the SOAP message – "SOAP over HTTP(S)."
With JAX-WS, @SOAPBinding annotation defined by javax.jws.soap.SOAPBinding interface provides details about the SOAP binding. And you need to know below attributes:
style (Style.DOCUMENT (default); Style.RPC)
DOCUMENT: valid XML document
RPC: Each message part within the SOAP body has a parameter or return value and will appear inside a wrapper element within the soap:body element.
use (Use.LITERAL (default); Use.ENCODED)
Specifies how the data of the SOAP message is streamed.
parameterStyle (ParameterStyle.BARE;ParameterStyle.WRAPPED (default) )
Specifies how the method parameters, which correspond to message parts in a WSDL contract, are placed into the SOAP message body.
If @SOAPBinding annotation is not specified , a service will be published using a wrapped doc/literal SOAP binding.
1. Change hello web service to add a new Person class
2. Below are the possible values of SOAP binding
3. Rebuild client and copy the source files to your workspace
wsconsume -k -p jboss.ws.hello.client http://localhost:8080/iJBossWS/ws/testService?wsdl
4. Write a test case
5 Compare types definitions
6 Compare out-bound messages
7 Compare in-bound message
8 pom.xml is the same as Day 1 example.
No comments:
Post a Comment