Author: jliu
Date: Wed Sep 20 03:15:39 2006
New Revision: 448148
URL: http://svn.apache.org/viewvc?view=rev&rev=448148
Log:
[CXF-93]
* Added RESTful sample
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java
(with props)
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
(with props)
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,150 @@
+RESTful Hello World Demo
+========================
+
+The demo demonstrates the REST based webservices using XML binding and
+JAX-WS Provider/Dispatch. The rest server provides following services:
+
+A RESTful customer service is provided on URL
http://localhost:9000/customerservice/customers,
+users access this URI to query or update customer info.
+
+A HTTP GET request to URL http://localhost:9000/customerservice/customers
returns
+a list of customer hyperlinks, this allows client navigates through the
+application states. The xml document returned:
+
+<Customers>
+ <Customer href="http://localhost/customerservice/customer?id=1234">
+ <id>1234</id>
+ </Customer>
+ <Customer href="http://localhost/customerservice/customer?id=1235">
+ <id>1235</id>
+ </Customer>
+ <Customer href="http://localhost/customerservice/customer?id=1236">
+ <id>1236</id>
+ </Customer>
+</Customers>
+
+A HTTP GET request to URL
http://localhost:9000/customerservice/customers?id=1234
+returns a customer instance whose id is 1234. The xml document returned:
+
+<Customer>
+ <id>1234</id>
+ <name>John</name>
+ <phoneNumber>123456</phoneNumber>
+</Customer>
+
+A HTTP POST request to URL http://localhost:9000/customerservice/customers
with data:
+
+<Customer>
+ <id>1234</id>
+ <name>John</name>
+ <phoneNumber>234567</phoneNumber>
+</Customer>
+
+updates customer 1234 with the data provided.
+
+The demo client codes demonstrate how to sent HTTP POST with XML data using
+JAX-WS dispatch and how to sent HTTP GET using URL.openStream().
+
+
+Please review the README in the samples directory before
+continuing.
+
+
+Prerequisite
+------------
+
+If your environment already includes cxf.jar on the
+CLASSPATH, and the JDK and ant bin directories on the PATH
+it is not necessary to run the environment script described in
+the samples directory README. If your environment is not
+properly configured, or if you are planning on using wsdl2java,
+javac, and java to build and run the demos, you must set the
+environment by running the script.
+
+
+
+Building and running the demo using ant
+---------------------------------------
+
+From the samples/restful directory, the ant build script
+can be used to build and run the demo.
+
+Using either UNIX or Windows:
+
+ ant build
+ ant server
+ ant client
+
+
+To remove the code generated from the WSDL file and the .class
+files, run:
+
+ ant clean
+
+
+
+Buildng the demo using wsdl2java and javac
+------------------------------------------
+
+From the samples/restful directory, first create the target
+directory build/classes and then generate code from the WSDL file.
+
+For UNIX:
+ mkdir -p build/classes
+
+ wsdl2java -d build/classes -compile ./wsdl/hello_world.wsdl
+
+For Windows:
+ mkdir build\classes
+ Must use back slashes.
+
+ wsdl2java -d build\classes -compile .\wsdl\hello_world.wsdl
+ May use either forward or back slashes.
+
+Now compile the provided client and server applications with the commands:
+
+For UNIX:
+
+ export CLASSPATH=$CLASSPATH:$CXF_HOME/lib/cxf.jar:./build/classes
+ javac -d build/classes src/demo/hw/client/*.java
+ javac -d build/classes src/demo/hw/server/*.java
+
+For Windows:
+ set classpath=%classpath%;%CXF_HOME%\lib\cxf.jar;.\build\classes
+ javac -d build\classes src\demo\hw\client\*.java
+ javac -d build\classes src\demo\hw\server\*.java
+
+
+
+Running the demo using java
+---------------------------
+
+From the samples/hello_world directory run the commands, entered on a
+single command line:
+
+For UNIX (must use forward slashes):
+ java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+ demo.hw.server.Server &
+
+ java -Djava.util.logging.config.file=$CXF_HOME/etc/logging.properties
+ demo.hw.client.Client ./wsdl/hello_world.wsdl
+
+The server process starts in the background. After running the client,
+use the kill command to terminate the server process.
+
+For Windows (may use either forward or back slashes):
+ start
+ java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+ demo.hw.server.Server
+
+ java -Djava.util.logging.config.file=%CXF_HOME%\etc\logging.properties
+ demo.hw.client.Client .\wsdl\hello_world.wsdl
+
+A new command windows opens for the server process. After running the
+client, terminate the server process by issuing Ctrl-C in its command window.
+
+To remove the code generated from the WSDL file and the .class
+files, either delete the build directory and its contents or run:
+
+ ant clean
+
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/README.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml?view=auto&rev=448148
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
(added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project name="RESTful demo" default="build" basedir=".">
+
+ <import file="../common_build.xml"/>
+
+ <target name="client" description="run demo client" depends="build">
+ <property name="param" value=""/>
+ <cxfrun classname="demo.restful.client.Client"
+ param1="${basedir}/wsdl/hello_world_xml_wrapped.wsdl"
+ param2="${op}"
+ param3="${param}"/>
+ </target>
+
+ <target name="server" description="run demo server" depends="build">
+ <cxfrun classname="demo.restful.server.Server"
+ param1="${basedir}/wsdl/hello_world_xml_wrapped.wsdl"/>
+ </target>
+
+ <target name="generate.code">
+ <echo level="info" message="Generating code using wsdl2java..."/>
+ <wsdl2java file="hello_world_xml_wrapped.wsdl"/>
+ </target>
+
+</project>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,122 @@
+/**
+ * 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.
+ */
+
+package demo.restful.client;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.helpers.XMLUtils;
+
+import org.apache.hello_world_xml_http.wrapped.Cutomerservice;
+
+
+public final class Client {
+
+ private Client() {
+ }
+
+ public static void main(String args[]) throws Exception {
+ if (args.length == 0) {
+ System.out.println("please specify wsdl");
+ System.exit(1);
+ }
+
+ URL wsdlURL;
+ File wsdlFile = new File(args[0]);
+ if (wsdlFile.exists()) {
+ wsdlURL = wsdlFile.toURL();
+ } else {
+ wsdlURL = new URL(args[0]);
+ }
+
+ System.out.println(wsdlURL + "\n\n");
+
+ QName serviceName = new
QName("http://apache.org/hello_world_xml_http/wrapped",
+ "cutomerservice");
+ QName portName = new
QName("http://apache.org/hello_world_xml_http/wrapped",
+ "RestProviderPort");
+
+ Cutomerservice service = new Cutomerservice(wsdlURL, serviceName);
+
+ Client client = new Client();
+ InputStream is =
client.getClass().getResourceAsStream("CustomerJohnReq.xml");
+ Document doc = XMLUtils.parse(is);
+ DOMSource reqMsg = new DOMSource(doc);
+
+ // Sent HTTP POST request to update customer info
+ Dispatch<DOMSource> disp = service.createDispatch(portName,
DOMSource.class, Service.Mode.PAYLOAD);
+ System.out.println("Invoking server through HTTP POST to update
customer info");
+ DOMSource result = disp.invoke(reqMsg);
+ printSource(result);
+
+ // Sent HTTP GET request to query all customer info
+ String endpointAddress =
"http://localhost:9000/customerservice/customer";
+ URL url = new URL(endpointAddress);
+ System.out.println("Invoking server through HTTP GET to query all
customer info");
+ InputStream in = url.openStream();
+ StreamSource source = new StreamSource(in);
+ printSource(source);
+
+ // Sent HTTP GET request to query customer info
+ endpointAddress = "http://localhost:9000/customerservice/customer";
+ url = new URL(endpointAddress + "?id=1234");
+ System.out.println("Invoking server through HTTP GET to query customer
info");
+ in = url.openStream();
+ source = new StreamSource(in);
+ printSource(source);
+
+ System.exit(0);
+ }
+
+ private static void printSource(Source source) {
+ try {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ StreamResult sr = new StreamResult(bos);
+ Transformer trans =
TransformerFactory.newInstance().newTransformer();
+ Properties oprops = new Properties();
+ oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ trans.setOutputProperties(oprops);
+ trans.transform(source, sr);
+ System.out.println("**** Response ******");
+ System.out.println(bos.toString());
+ bos.close();
+ System.out.println();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/Client.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,3 @@
+<tns:Customer xmlns:tns="http://apache.org/hello_world_soap_http/types">
+ <tns:id>123456</tns:id>
+</tns:Customer>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/client/CustomerJohnReq.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Customers>
+ <Customer href="http://localhost/customerservice/customer?id=1234">
+ <id>1234</id>
+ </Customer>
+ <Customer href="http://localhost/customerservice/customer?id=1235">
+ <id>1235</id>
+ </Customer>
+ <Customer href="http://localhost/customerservice/customer?id=1236">
+ <id>1236</id>
+ </Customer>
+</Customers>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerAllResp.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Customer>
+ <name>John</name>
+ <id>123456</id>
+</Customer>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/CustomerJohnResp.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,109 @@
+/**
+ * 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.
+ */
+
+package demo.restful.server;
+
+import java.io.InputStream;
+
+import javax.annotation.Resource;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.handler.MessageContext;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.message.Message;
+
[EMAIL PROTECTED]()
[EMAIL PROTECTED](value = Service.Mode.PAYLOAD)
[EMAIL PROTECTED](value = "http://cxf.apache.org/bindings/xformat")
+public class RestSourcePayloadProvider implements Provider<DOMSource> {
+
+ @Resource
+ protected WebServiceContext wsContext;
+
+ public RestSourcePayloadProvider() {
+ }
+
+ public DOMSource invoke(DOMSource request) {
+ MessageContext mc = wsContext.getMessageContext();
+ String path = (String)mc.get(Message.PATH_INFO);
+ String query = (String)mc.get(Message.QUERY_STRING);
+ String httpMethod = (String)mc.get(Message.HTTP_REQUEST_METHOD);
+
+ System.out.println("--path--- " + path);
+ System.out.println("--query--- " + query);
+ System.out.println("--httpMethod--- " + httpMethod);
+
+ if (httpMethod.equalsIgnoreCase("POST")) {
+ // TBD: parse query info from DOMSource
+ System.out.println("---Invoking updateCustomer---");
+ return updateCustomer(request);
+ } else if (httpMethod.equalsIgnoreCase("GET")) {
+ if (path.equals("/customerservice/customer") && query == null) {
+ System.out.println("---Invoking getAllCustomers---");
+ return getAllCustomers();
+ } else if (path.equals("/customerservice/customer") && query !=
null) {
+ System.out.println("---Invoking getCustomer---");
+ return getCustomer(query);
+ }
+ }
+
+ return null;
+ }
+
+ private DOMSource getAllCustomers() {
+ return createDOMSource("CustomerAllResp.xml");
+ }
+
+ private DOMSource getCustomer(String customerID) {
+ return createDOMSource("CustomerJohnResp.xml");
+ }
+
+ private DOMSource updateCustomer(DOMSource request) {
+ // TBD: returned update customer info
+ return createDOMSource("CustomerJohnResp.xml");
+ }
+
+ private DOMSource createDOMSource(String fileName) {
+ DocumentBuilderFactory factory;
+ DocumentBuilder builder;
+ Document document = null;
+ DOMSource response = null;
+
+ try {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(true);
+ builder = factory.newDocumentBuilder();
+ InputStream greetMeResponse =
getClass().getResourceAsStream(fileName);
+
+ document = builder.parse(greetMeResponse);
+ response = new DOMSource(document);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/RestSourcePayloadProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+package demo.restful.server;
+
+import javax.xml.ws.Endpoint;
+
+public class Server {
+
+ protected Server() throws Exception {
+ System.out.println("Starting Server");
+ Object implementor = new RestSourcePayloadProvider();
+ String address = "http://localhost:9000/customerservice/customer";
+ Endpoint.publish(address, implementor);
+ }
+
+ public static void main(String args[]) throws Exception {
+ new Server();
+ System.out.println("Server ready...");
+
+ Thread.sleep(5 * 60 * 1000);
+ System.out.println("Server exiting");
+ System.exit(0);
+ }
+}
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/src/demo/restful/server/Server.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl?view=auto&rev=448148
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
Wed Sep 20 03:15:39 2006
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<wsdl:definitions name="HelloWorld"
+ targetNamespace="http://apache.org/hello_world_xml_http/wrapped"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:tns="http://apache.org/hello_world_xml_http/wrapped"
+ xmlns:x1="http://apache.org/hello_world_xml_http/wrapped/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xformat="http://cxf.apache.org/bindings/xformat"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema
+
targetNamespace="http://apache.org/hello_world_xml_http/wrapped/types"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+ <element name="sayHi">
+ <complexType />
+ </element>
+ <element name="sayHiResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType"
type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="greetMe">
+ <complexType>
+ <sequence>
+ <element name="requestType"
type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeResponse">
+ <complexType>
+ <sequence>
+ <element name="responseType"
type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="greetMeOneWay">
+ <complexType>
+ <sequence>
+ <element name="requestType"
type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="pingMe">
+ <complexType />
+ </element>
+ <element name="pingMeResponse">
+ <complexType />
+ </element>
+ <element name="faultDetail">
+ <complexType>
+ <sequence>
+ <element name="minor"
type="xsd:short" />
+ <element name="major"
type="xsd:short" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="sayHiRequest">
+ <wsdl:part element="x1:sayHi" name="in" />
+ </wsdl:message>
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part element="x1:sayHiResponse" name="out" />
+ </wsdl:message>
+ <wsdl:message name="greetMeRequest">
+ <wsdl:part element="x1:greetMe" name="in" />
+ </wsdl:message>
+ <wsdl:message name="greetMeResponse">
+ <wsdl:part element="x1:greetMeResponse" name="out" />
+ </wsdl:message>
+ <wsdl:message name="greetMeOneWayRequest">
+ <wsdl:part element="x1:greetMeOneWay" name="in" />
+ </wsdl:message>
+
+ <wsdl:message name="pingMeRequest">
+ <wsdl:part name="in" element="x1:pingMe" />
+ </wsdl:message>
+ <wsdl:message name="pingMeResponse">
+ <wsdl:part name="out" element="x1:pingMeResponse" />
+ </wsdl:message>
+ <wsdl:message name="pingMeFault">
+ <wsdl:part name="faultDetail" element="x1:faultDetail" />
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHiRequest"
name="sayHiRequest" />
+ <wsdl:output message="tns:sayHiResponse"
+ name="sayHiResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input message="tns:greetMeRequest"
+ name="greetMeRequest" />
+ <wsdl:output message="tns:greetMeResponse"
+ name="greetMeResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input message="tns:greetMeOneWayRequest"
+ name="greetMeOneWayRequest" />
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <wsdl:input name="pingMeRequest"
+ message="tns:pingMeRequest" />
+ <wsdl:output name="pingMeResponse"
+ message="tns:pingMeResponse" />
+ <wsdl:fault name="pingMeFault"
message="tns:pingMeFault" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+ <wsdl:binding name="Greeter_XMLBinding" type="tns:Greeter">
+ <xformat:binding />
+
+ <wsdl:operation name="sayHi">
+ <wsdl:input name="sayHiRequest" />
+ <wsdl:output name="sayHiResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMe">
+ <wsdl:input name="greetMeRequest" />
+ <wsdl:output name="greetMeResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="greetMeOneWay">
+ <wsdl:input name="greetMeOneWayRequest" />
+ </wsdl:operation>
+
+ <wsdl:operation name="pingMe">
+ <wsdl:input />
+ <wsdl:output />
+ <wsdl:fault name="pingMeFault" />
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="cutomerservice">
+ <wsdl:port binding="tns:Greeter_XMLBinding"
name="RestProviderPort">
+ <http:address
+
location="http://localhost:9000/customerservice/customer" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/restful/wsdl/hello_world_xml_wrapped.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java?view=diff&rev=448148&r1=448147&r2=448148
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java
Wed Sep 20 03:15:39 2006
@@ -36,13 +36,7 @@
import org.apache.cxf.message.Message;
-// The following wsdl file is used.
-// wsdlLocation =
-// "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
[EMAIL PROTECTED](portName = "XMLProviderPort",
- serviceName = "SOAPServiceRPCLit2",
- targetNamespace = "http://apache.org/hello_world_rpclit",
- wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
[EMAIL PROTECTED]()
@ServiceMode(value = Service.Mode.PAYLOAD)
@javax.xml.ws.BindingType(value = "http://cxf.apache.org/bindings/xformat")
public class RestSourcePayloadProvider implements Provider<DOMSource> {