Making Simple Substitutions Using Curly Braces

The simplest kind of mapping you can do is to map one Java value with one XML value. For these cases, the best way to map the two is by using {} (curly braces) to indicate where the Java values fit into the XML message.

For example, consider the following snippet of an XML message carrying data used to submit a request for information about a manufacturer's inventory:

    <getInventory>
        <queryData>
            <part id="34860984">Flangyhoffklinger</part>
        </queryData>
    </getInventory>

The following example might be designed to respond to the preceding message snippet. As you can see, by enclosing the method's parameter names in {}, you tell WebLogic Server what belongs where. The serialNumber parameter value is mapped to the id attribute, and the partName parameter value is mapped to the <part> element.

    /**
     * @jws:operation
     * @jws:parameter-xml xml-map::
     *     <getInventory>
     *     <queryData>
     *         <part id="{serialNumber}">{partName}</part>
     *     </queryData>
     *    </getInventory>
     * ::
     */
    public int getInventory(String serialNumber, String partName)
    {...}

Note: The <xm:value> and <xm:attribute> tags are alternatives to using curly braces.

You also use the curly braces to include a reference to ECMAScript or a separate map file. For more information, see Using Script Functions From XML Maps and Creating Reusable Maps.

Related Topics

Matching XML Shapes

<xm:value> Tag

<xm:attribute> Tag

<xm:use> Tag