+

Search Tips   |   Advanced Search

 

Mapping between Java language, WSDL and XML for JAX-RPC applications

 

Data for Java API for XML-based Remote Procedure Call (JAX-RPC) applications flows as extensible Markup Language (XML). JAX-RPC applications use mappings to describe the data conversion between the Java language and extensible Markup Language (XML) technologies, including XML Schema, Web Services Description Language (WSDL) and SOAP that are supported by WebSphere Application Server.

For JAX-RPC applications, most of the mappings between the Java language and XML are specified by the JAX-RPC specification. Some mappings that are optional or unspecified in JAX-RPC are also supported. Review the JAX-RPC specification for a complete list of API's. You can also review several articles about the development of Web services at Web services: Resources for learning.

 

Notational conventions

The following table specifies the namespace prefixes and corresponding namespace used.

Namespace prefix Namespace
xsd http://www.w3.org/2001/XMLSchema
xsi http://www.w3.org/2001/XMLSchema-instance
soapenc http://schemas.xmlsoap.org/soap/encoding/
wsdl http://schemas.xmlsoap.org/wsdl/
wsdlsoap http://schemas.xmlsoap.org/wsdl/soap/
ns user-defined namespace
apache http://xml.apache.org/xml-soap
wasws http://websphere.ibm.com/webservices/

 

Detailed mapping information

The following sections identify the supported mappings, including:

 

Java-to-WSDL mapping

This section summarizes the Java-to-WSDL mapping rules. The Java-to-WSDL mapping rules are used by the Java2WSDL command for bottom-up processing. In bottom-up processing, an existing Java service implementation is used to create a WSDL file defining the Web service. The generated WSDL file can require additional manual editing for the following reasons:

For simple services, the generated WSDL file is sufficient. For complicated services, the generated WSDL file is a good starting point. General issues

 

WSDL-to-Java mapping

The WSDL2Java command generates Java classes using information described in the WSDL file.

General issues


 

Mapping between WSDL and SOAP messages

The WSDL file defines the format of the SOAP message that are transmitted through network connections. The WSDL2Java command and the WebSphere Application Server runtime use the information in the WSDL file to ensure that the SOAP message is properly serialized and deserialized.

DOCUMENT versus RPC, LITERAL versus ENCODED

If a wsdl:binding element indicates that a message is sent using an RPC format, the SOAP message contains an element defining the operation. If a wsdl:binding element indicates that the message is sent using a document format, the SOAP message does not contain the operation element.

If the wsdl:part element is defined using the type attribute, the name and type of the part are used in the message. If the wsdl:part element is defined using the element attribute, the name and type of the element are used in the message. The element attribute is not supported by the JAX-RPC specification when use="encoded". If a wsdl:binding element indicates that a message is encoded, the values in the message are sent with xsi:type information. If a wsdl:binding element indicates that a message is literal, the values in the message are typically not sent with xsi:type information. For example:

DOCUMENT/LITERAL

WSDL: <xsd:element name="c" type="xsd:int"/> <xsd:element name="method"> <xsd:complexType> <xsd:sequence> <xsd:element name="a" type="xsd:string"/> <xsd:element ref="ns:c"/> </xsd:sequence> </xsd:complexType> </xsd:element> ... <wsdl:message name="request"> <part name="parameters" element="ns:method"/> </wsdl:message> ... <wsdl:operation name="method"> <input message="request"/> ...

Message: <soap:body> <ns:method> <a>ABC</a> <c>123</a> <ns:method> </soap:body>

RPC/ENCODED

WSDL: <xsd:element name="c" type="xsd:int"/> ... <wsdl:message name="request"> <part name="a" type="xsd:string"/> <part name="b" element="ns:c"/> </wsdl:message> ... <wsdl:operation name="method"> <input message="request"/> ...

Message: <soap:body> <ns:method> <a xsi:type="xsd:string">ABC</a> <element attribute is not allowed in rpc/encoded mode> </ns:method> </soap:body>

DOCUMENT/LITERAL  not wrapped 

WSDL: <xsd:element name="c" type="xsd:int"/> ... <wsdl:message name="request"> <part name="a" type="xsd:string"/> <part name="b" element="ns:c"/> </wsdl:message> ... <wsdl:operation name="method"> <input message="request"/> ...

Message: <soap:body> <a>ABC</a> <c>123</a> </soap:body>




 

Related concepts


Web Services-Interoperability Basic Profile

 

Related tasks


Developing a WSDL file for JAX-RPC applications

 

Related Reference


Java2WSDL command for JAX-RPC applications
WSDL2Java command for JAX-RPC applications
Multipart WSDL best practices
Web services: Resources for learning

 

Reference topic