01 package xqueryMap;
02
03 /**
04 * This web service illustrates a simple return-XML XQuery map.
05 *
06 * @common:xmlns namespace="http://openuri.org/bea/samples/workshop/xmlmap/outputMap" prefix="ns0"
07 * @common:target-namespace namespace="http://workshop.bea.com/OutputMap"
08 */
09 public class OutputMap implements com.bea.jws.WebService
10 {
11 public static class Person
12 {
13 public String fname;
14 public String lname;
15 public Person() {}
16 public Person (String first, String last)
17 {
18 fname = first;
19 lname = last;
20 }
21 }
22
23 /**
24 * This method uses a simple XQuery map to ensure that the outgoing message carrying
25 * its return value conforms to a particular schema. The elements that make up the
26 * map's template (elements such as ns1:EMPLOYEE) match those defined by the schema.
27 * XQuery expressions (such as $input/ns0:HelloResult/ns0:fname) select values from
28 * the default XML generated from the method's Java signature. At runtime,
29 * WebLogic Server runtime components execute the XQuery expressions against
30 * the default XML, then insert the resulting values into the template formed by
31 * the map.<br/><br/>
32 *
33 * <strong>Be sure to use the Test XML tab -- not Text Form -- to test this method.</strong>
34 * To test this method, replace the contents of the fname and lname elements that
35 * Test View provides on the Test XML tab with your own values. In other words, you're
36 * replacing the "string" default values.<br/><br/>
37 *
38 * For the schema that defines this method's outgoing message, see OutputMap.xsd in the
39 * Schemas project of the SamplesApp application. The resulting XML itself will
40 * be displayed in Test View when the method's results have returned.
41 * <br/>
42 *
43 * @common:operation
44 * @jws:return-xml xquery::
45 * declare namespace ns0 = "http://workshop.bea.com/OutputMap"
46 * declare namespace ns1 = "http://openuri.org/bea/samples/workshop/xmlmap/outputMap"
47 *
48 * <ns1:EMPLOYEE>
49 * <ns1:FIRSTNAME>{ data($input/ns0:HelloResult/ns0:fname) }</ns1:FIRSTNAME>
50 * <ns1:LASTNAME>{ data($input/ns0:HelloResult/ns0:lname) }</ns1:LASTNAME>
51 * </ns1:EMPLOYEE>
52 * ::
53 * schema-element="ns0:EMPLOYEE"
54 */
55 public Person Hello (String fname, String lname)
56 {
57 return new Person(fname, lname);
58 }
59 }
|