You can store XML map code in a file separate from your JWS or JCX file. This enables you to call a map from code in multiple services and use a map in multiple projects. When creating an XML map file, you add a new file to your project, give it an .xmlmap extension, and add code to make it a self-contained map file. To use a map in a XMLMAP file, you refer to it from within a parameter-xml or return-xml map using the <xm:use> map tag.
Note: Whenever possible, it is a good practice to create and debug an XML map with the Edit Maps and Interface dialog because it provides code completion and error checking. You can then remove the map to a separate file and enclose it with the tags needed to make it self-contained. For more information on the Edit Maps and Interface dialog, see How Do I: Add or Edit an XML Map with the Edit Maps and Interface Dialog?
For more detailed information on what makes up an XML map file, see Creating Reusable Maps.
To Create an XMLMAP file
Note: If this map file will contain multiple maps, you may want to give it a name that conveys a sense of the maps as a group, such as POMaps for maps that handle purchase orders.
<xm:map-file xmlns:xm="http://www.bea.com/2002/04/xmlmap/">
<xm:xml-map signature="mapName(datatype parameter)"> ...text of the XML map... </xm:xml-map>
To learn more about constructing the text of an XML map, see How Do XML Maps Work? and Matching XML Shapes.
The following is an example of code you might create with this procedure:
<xm:map-file xmlns:xm="http://www.bea.com/2002/04/xmlmap/"> <xm:xml-map signature="placeOrder(String partID, int quantity)"> ... text of the XML map... </xm:xml-map> </xm:map-file>
To Refer to a Map in a XMLMAP File from Within an XML Map
/* * @jws:mode-xml xml-map:: * <methodName> * <xm:use call="MapFileName.mapName(datatype parameter)"/> * </methodName> * :: */
The following is an example of code to invoke a parameter-xml map:
/* * @jws:parameter-xml xml-map:: * <methodName> * <xm:use call="CustomerRequests.placeOrder(String)"/> * </methodName> * :: */
How Do I: Add or Edit an XML Map with the Edit Maps and Interface Dialog?