When your service must handle a particular incoming XML message shape, you can create an XML map as an translation layer between the incoming message and the Java parameters that your method expects. XML maps are particularly useful in cases where a web service you develop must respond to messages whose shape is beyond your control. Maps enable you to handle those messages without changing your code.
In the simplest example, you specify this mapping with substitution directive such as {} for the XML element value you want to map. In the following example, parameters in the declaration are mapped to element and attribute values.
/** * @common:operation * @jws:parameter-xml xml-map:: * <searchRequest> * <partName partID="{serialNumber}">{productName}</partName> * <number>{quantity}</number> * </searchRequest> * :: */ public String searchRequest (String productName, String serialNumber, int quantity)
Note: You will find an introduction to XML maps at Why Use XML Maps?
Depending on how the incoming message arrives at your service, you will create a map that converts an XML message into the parameters of your Java method. The following section lists the four circumstances under which an incoming XML message can arrive at your service, and describes which kind of map you should use for each.
Note: For each of the incoming message source described in this topic, there is a related outgoing message source. For more information on mapping to shape outgoing messages, see How Do I: Ensure that Outgoing XML Messages Conform to a Particular Shape.
An incoming message can arrive:
Note: When you edit a map associated with a control, you are modifying the JCX file that defines the control. Remember that the JCX file may be used by other web services. If you wish to edit maps on a control without affecting other web services, you should create a new control that is not shared.
Note: When you edit a map associated with a control, you are modifying the JCX file that defines the control. Remember that the JCX file may be used by other web services. If you wish to edit maps on a control without affecting other web services, you should create a new control that is not shared.