O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required