Menu Search Sign up

Java JAX-WS

 

http://www.mkyong.com/tutorials/jax-ws-tutorials/

 

The Document style indicates that the SOAP body contains a XML document which can be validated against pre-defined XML schema document.
RPC indicates that the SOAP message body contains an XML representation of a method call and uses the names of the method and its parameters to generate
XML structures that represent a method’s call stack. The document/literal approach is easier because it simply relies on XML Schema to describe exactly
what the SOAP message looks like while transmission.

SOAP Encoding indicates how a data value should be encoded in an XML format. SOAP Encoding is an extension of the SOAP framework. SOAP encoding offers
rules to convert any data value defined in SOAP data model into XML format.

What is Literal?
In simplest definition, literal it means that the data is serialized according to a schema
--------------------------
In JAX-WS RPC/encoded is not supported as a messaging mode. In JAX-WS the “encoded” encoding style isn’t supported and only the “literal” encoding style
used.
If you use wsimport/wsgen on wsdl documents/SEI that has use=”encoded” attribute/SOAP binding you may get the following error,

“….. invalid SOAP Binding annotation. Rpc/encoded SOAPBinding is not supported”

Or

“ rpc/encoded wsdls are not supported in JAXWS 2.0. “

You can use JAX-RPC or Apache Axis V1 , f you want to send SOAP encoded messages or create RPC/encoded style WSDL.

--------------------------
RPC /LITERAL SOAP Binding Example Web Service

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://globinch.com">
<soapenv:Header/>
<soapenv:Body>
<glob:getGreetingRequest>
<name>Binu George</name>
</glob:getGreetingRequest>
</soapenv:Body>
</soapenv:Envelope>


<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getGreetingRequestResponse xmlns:ns2="http://globinch.com">
<GreetingResponse>
<message>Hello</message>
<name>Binu George</name>
</GreetingResponse>
</ns2:getGreetingRequestResponse>
</S:Body>
</S:Envelope>
--------------------------
Document/Literal SOAP Binding Web service

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://globinch.com/ws/types">
<soapenv:Header/>
<soapenv:Body>
<typ:name>Binu George</typ:name>
</soapenv:Body>
</soapenv:Envelope>

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns3:GreetingResponse xmlns:ns2="http://globinch.com" xmlns:ns3="http://globinch.com/ws/types">
<message>Hello</message>
<name>Binu George</name>
</ns3:GreetingResponse>
</S:Body>
</S:Envelope>