PersonScript.jsx Sample
This topic inludes the source code for the PersonScript.jsx 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 import xqueryMap.Person;
02
03 /*
04 * Receives XML generated from the Hello method return type
05 * in OutputScriptMap.jws. This function extracts the XML values
06 * and places them into a slightly different XML shape (one whose
07 * element names are capitalized). It returns that XML as the
08 * actual return value of the Hello method.
09 */
10 function ConvertPerson(person)
11 {
12 /*
13 * Declare the namespace that will be used when constructing
14 * the XML below. The namespace declared here is the one used
15 * by the XML received by this function.
16 */
17 ns = new Namespace("http://workshop.bea.com/OutputScriptMap");
18
19 /*
20 * Construct the XML that will be returned by this function.
21 * The incoming XML's values are extracted using syntax such
22 * as "person.ns::fname", where:
23 * "person" is an element name
24 * the dot indicates descent to a child element
25 * "ns" represents the namespace to which these elements belong
26 * (as declared above); "::" is a separator
27 * "fname" is a child of the person element.
28 *
29 * This XML is passed to the XQuery map that called this
30 * script, where it is incorporated into the Hello method's
31 * return value.
32 */
33 return <ns1:PERSON xmlns:ns1="http://openuri.org/bea/samples/workshop/xqueryMap/personScript">
34 <ns1:FNAME>{person.ns::fname}</ns1:FNAME>
35 <ns1:LNAME>{person.ns::lname}</ns1:LNAME>
36 </ns1:PERSON>;
37 }
|