Web Service Java/WSDL Mappings

When deploying JAX-RPC web services in a J2EE application, each web service must have a mapping file that describes how the Java entities in the service implementation and the XML entities in the WSDL are mapped to each other. The mapping file is included in the component archive and specified in the webservices.xml deployment descriptor. Figure A-16 shows the structure of JAX-RPC mapping files.

Example A-16 shows sample Java/WSDL mappings , annotated with descriptive comments.

Web services Java/WSDL mappings

Figure A-16. Web services Java/WSDL mappings

Example A-16. Annotated Java/WSDL mappings

<?xml version="1.0" encoding="UTF-8"?>
<java-wsdl-mapping
                          xmlns="http://java.sun.com/xml/ns/j2ee"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                              http://java.sun.com/xml/ns/j2ee/j2ee_jaxrpc_mapping_1_1.xsd"
                          version="1.1">
    <!-- Each package-mapping element specifies how a Java package
         is mapped to an XML namespace in the WSDL for the service. -->
    <package-mapping>
        <!-- The Java package for the mapping. -->
        <package-type>com.my.service.datatypes</package-type>
        <!-- The XML namespace to be mapped to this package. -->
        <namespaceURI>my-service-ns</namespaceURI>
                      </package-mapping>
    <!-- Each java-xml-type-mapping element specifies how to map an
         XML element to a corresponding Java type. -->
    <java-xml-type-mapping> <!-- The full classname ...

Get Java Enterprise in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.