OutputScriptMap.jws Sample

This topic inludes the source code for the OutputScriptMap.jws Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/xqueryMap/

Sample Source Code


01 package xqueryMap;
02 
03 import xqueryMap.Person;
04 
05 /**
06  * Demonstrates use of XQuery maps in combination with script 
07  * to do special formatting and processing when tranforming Java 
08  * objects to XML.
09  <br/><br/>
10  * You can call script in a JSX file from an XQuery map to
11  * incorporate logic that may not be possible in the XQuery itself.
12  
13  * @common:xmlns namespace="http://openuri.org/bea/samples/workshop/xqueryMap/personScript" prefix="ns0"
14  * @common:target-namespace namespace="http://workshop.bea.com/OutputScriptMap"
15  */
16 public class OutputScriptMap implements com.bea.jws.WebService 
17 {
18    /**
19     * Returns the XML response of this method as translated by 
20     * a JSX file called from an XQuery map. The JSX file contains
21     * script that formats into another shape the XML that would 
22     * have otherwise been generated from the Person object this
23     * method returns.
24     <br/><br/>
25     * To test this method, enter any values in the fname and lname
26     * boxes, then click the Hello button.
27     *
28     * @common:operation
29     * @jws:return-xml schema-element="ns0:EMPLOYEE" xquery::
30     * declare namespace ns0="http://workshop.bea.com/OutputScriptMap"
31     * declare namespace ns1="http://openuri.org/bea/samples/workshop/xqueryMap/personScript"
32     
33     <ns1:EMPLOYEE>
34     *     {xqueryMap.PersonScript.ConvertPerson($input)}
35     </ns1:EMPLOYEE>
36     * ::
37     */
38     public Person Hello (String fname, String lname)
39     {
40        return new Person(fname, lname);
41     }
42 }