Hi, Here is a patch for js client demo which can run against CXF java server(hello_world). I have tested on Windows and Linux, and write readme.txt file.
Could someone review it and apply patch for me? Thanks Jeff BTW: It seems apache maillist will filter the attached file. Some format in text will be lost. I can send the zip file to reviewer later. Index: distribution/src/main/release/samples/js_client/logging.properties =================================================================== --- distribution/src/main/release/samples/js_client/logging.properties (revision 0) +++ distribution/src/main/release/samples/js_client/logging.properties (revision 0) @@ -0,0 +1,2 @@ +java.util.logging.ConsoleHandler.level = WARN +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter Index: distribution/src/main/release/samples/js_client/run_client =================================================================== --- distribution/src/main/release/samples/js_client/run_client (revision 0) +++ distribution/src/main/release/samples/js_client/run_client (revision 0) @@ -0,0 +1,3 @@ +CXF_HOME= +HELLO_WORLD_DEMO=$CXF_HOME/samples/hello_world +$JAVA_HOME/bin/java -classpath $CXF_HOME/lib/cxf-manifest-incubator.jar:$CXF_HOME/lib/js-1.6R5.jar:$HELLO_W ORLD_DEMO/build/classes:$CLASSPATH -Djava.util.logging.config.file=logger.pr operties org.mozilla.javascript.tools.shell.Main -f src/helloworld.js Index: distribution/src/main/release/samples/js_client/run_client.bat =================================================================== --- distribution/src/main/release/samples/js_client/run_client.bat (revision 0) +++ distribution/src/main/release/samples/js_client/run_client.bat (revision 0) @@ -0,0 +1,4 @@ +set CXF_HOME= +set HELLO_WORLD_DEMO=%CXF_HOME%\samples\hello_world + +%JAVA_HOME%\bin\java -classpath %CXF_HOME%\lib\cxf-manifest-incubator.jar;%CXF_HOME%\lib\js-1.6R5.jar;%HELLO _WORLD_DEMO%\build\classes;%CLASSPATH% -Djava.util.logging.config.file=logge r.properties org.mozilla.javascript.tools.shell.Main -f src\helloworld.js Index: distribution/src/main/release/samples/js_client/src/helloworld.js =================================================================== --- distribution/src/main/release/samples/js_client/src/helloworld.js (revision 0) +++ distribution/src/main/release/samples/js_client/src/helloworld.js (revision 0) @@ -0,0 +1,34 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +importPackage(Packages.java.io); +importPackage(Packages.javax.xml.namespace); +importPackage(Packages.org.apache.hello_world_soap_http); + +var qname=new Packages.javax.xml.namespace.QName("http://apache.org/hello_world_soap_http" , "SOAPService"); +var curpath=new File(".."); +var sepa=File.separator; +var hwpath=curpath.getAbsolutePath()+sepa+"hello_world"+sepa+"wsdl"+sepa+"hello_ world.wsdl"; +var url = new File(hwpath).toURL(); +var ss=new SOAPService(url,qname); +var port = ss.getSoapPort(); +var resp=port.sayHi(); +print("invoke sayHi(). return " + resp); +resp=port.greetMe("Jeff"); +print("invoke greetMe(String). return " + resp); Index: distribution/src/main/release/samples/js_client/README.txt =================================================================== --- distribution/src/main/release/samples/js_client/README.txt (revision 0) +++ distribution/src/main/release/samples/js_client/README.txt (revision 0) @@ -0,0 +1,62 @@ +Hello World Client Demo using JavaScript +========================================================= + +The client demo demonstrates the use of the JavaScript to call CXF server + +The client side makes call by JAXWS. It use mozilla Rhino library to read +java script file and run it. + +Prerequisite +------------ + +You should set the CXF_HOME environment to the CXF install path in +run_client and run_client.bat files. + +If your environment already includes cxf-manifest-incubator.jar on the +CLASSPATH, and the JDK and ant bin directories on the PATH. + +You also need to download js-1.6R5.jar from +(http://repo1.maven.org/maven2/rhino/js/1.6R5/) and xbean-2.2.0.jar +from (http://repo1.maven.org/maven2/xmlbeans/xbean/2.2.0/) and place +these two jars under CXF_HOME/lib directory. + + +Building and running the demo server using ant +--------------------------------------- + +From the samples/hello_world directory, the ant build script +can be used to build and run the demo. + +Using either UNIX or Windows: + + ant build + ant server (in the background or another window) + +To remove the code generated from the WSDL file and the .class +files, run: + + ant clean + +Running the demo using javascript +--------------------------- + +From the samples/js_client directory run the commands, entered on a +single command line: + +For UNIX (must use forward slashes): + ./run_client + +For Windows (may use either forward or back slashes): + run_client.bat + +When running the client, it can terminate the server process by issuing Ctrl-C in its command window. + +It will show the output: +invoke sayHi(). return Bonjour +invoke greetMe(String). return Hello Jeff + +The same time, server give the output: + [java] Executing operation sayHi + + [java] Executing operation greetMe + [java] Message received: Jeff
