OutputScriptMap.jws Sample

A web service that demonstrates use of the ECMAScript language extensions for XML to perform XML mapping using procedural code. A Java object returned by a web service method is converted to a different XML structure in the outgoing message. The ECMAScript is in the PersonScript.jsx file.

# Concepts Demonstrated by this Sample

- XML maps

- XML maps with ECMAScript

# Location of Sample Files

This sample is located in the xmlmap folder of the samples WebLogic Workshop project. In the file system the location is:

BEA_HOME\weblogic700\samples\workshop\applications\samples\xmlmap\OutputScriptMap.jws

# How to Run the Sample

To run this web service:

1. Start WebLogic Server in the appropriate domain.

   - On Microsoft Windows systems, from the Start menu navigate to:

   BEA WebLogic Platform 7.0->WebLogic Workshop->WebLogic Workshop Examples->Start Examples Server.

   - On Linux or Solaris systems, run:

   BEA_HOME/weblogic700/samples/workshop/startWebLogic.sh

2. Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/samples/xmlmap/OutputScriptMap.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine, you may click here to run the sample.

3. Navigate to the Test Form tab of Test View, if necessary.

4. Enter values for fname and lname and invoke the Hello method.

5. The Hello method receives the values using the default mapping (no custom XML map), but returns its result using an XML map specified with the @jws:return-xml tag. The @jws:return-xml tag includes a <xm:use> tag that calls the ConvertPersonToXML ECMAScript function in the PersonScript.jsx file.

6. The ECMAScript function formats the fields of the Person object into a schema it determines, then returns that XML to the client.

7. Examine PersonScript.ps and the relationship between the ECMAScript it contains and the method in OutputScriptMap.jws.

Related Topics

ConsolidateAddress.jws Sample

OutputMap.jws Sample

Handling and Shaping XML Messages with XML Maps

Handling XML with ECMAScript Extensions

<xm:use> Tag

@jws:return-xml Tag

Test View