You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2007/05/23 10:23:24 UTC
svn commit: r540879 - in /incubator/cxf/trunk: rt/bindings/http/
rt/bindings/http/src/test/java/org/apache/cxf/binding/http/
rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/
rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wra...
Author: ningjiang
Date: Wed May 23 01:23:21 2007
New Revision: 540879
URL: http://svn.apache.org/viewvc?view=rev&rev=540879
Log:
[CXF-664] Added restful-http-binding support in CXFServlet
1. Moved the customer types class from cxf-rt-binding-http to cxf-testutils for servlet systest using.
2. Added the restful supprot in the CXFServlet and ServletControl
3. Added HttpBindingServletTest for the restful service test
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml (with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java (with props)
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java (with props)
Removed:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/Customer.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/CustomerNotFoundDetails.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/CustomerNotFoundFault.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/Customers.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
Modified:
incubator/cxf/trunk/rt/bindings/http/pom.xml
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/spring.xml
incubator/cxf/trunk/testutils/pom.xml
Modified: incubator/cxf/trunk/rt/bindings/http/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/pom.xml?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/pom.xml (original)
+++ incubator/cxf/trunk/rt/bindings/http/pom.xml Wed May 23 01:23:21 2007
@@ -63,6 +63,12 @@
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-testutils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java Wed May 23 01:23:21 2007
@@ -29,6 +29,7 @@
import org.apache.cxf.binding.http.AbstractRestTest;
import org.apache.cxf.binding.http.HttpBindingFactory;
import org.apache.cxf.binding.http.URIMapper;
+import org.apache.cxf.customer.bare.CustomerService;
import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.service.model.BindingOperationInfo;
Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java Wed May 23 01:23:21 2007
@@ -25,9 +25,12 @@
import org.apache.cxf.binding.BindingFactoryManager;
import org.apache.cxf.binding.http.AbstractRestTest;
-import org.apache.cxf.binding.http.Customer;
-import org.apache.cxf.binding.http.Customers;
import org.apache.cxf.binding.http.HttpBindingFactory;
+import org.apache.cxf.customer.Customer;
+import org.apache.cxf.customer.Customers;
+import org.apache.cxf.customer.bare.CustomerService;
+import org.apache.cxf.customer.bare.GetCustomer;
+import org.apache.cxf.customer.bare.GetCustomers;
import org.apache.cxf.endpoint.ClientImpl;
import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java Wed May 23 01:23:21 2007
@@ -28,6 +28,7 @@
import org.apache.cxf.binding.http.HttpBindingFactory;
import org.apache.cxf.binding.http.URIMapper;
import org.apache.cxf.binding.http.strategy.ConventionStrategy;
+import org.apache.cxf.customer.wraped.CustomerService;
import org.apache.cxf.endpoint.ServerImpl;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.service.model.BindingOperationInfo;
Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java Wed May 23 01:23:21 2007
@@ -202,7 +202,7 @@
}
private void replaceDestionFactory() throws ServletException {
- DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+ DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
DestinationFactory df = dfm
.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
@@ -215,13 +215,14 @@
}
DestinationFactory factory = createServletTransportFactory();
-
+
registerTransport(factory, "http://schemas.xmlsoap.org/wsdl/soap/http");
registerTransport(factory, "http://schemas.xmlsoap.org/soap/http");
registerTransport(factory, "http://www.w3.org/2003/05/soap/bindings/HTTP/");
registerTransport(factory, "http://schemas.xmlsoap.org/wsdl/http/");
registerTransport(factory, "http://cxf.apache.org/transports/http/configuration");
registerTransport(factory, "http://cxf.apache.org/bindings/xformat");
+ registerTransport(factory, "http://schemas.xmlsoap.org/wsdl/soap/");
}
public void destroy() {
Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Wed May 23 01:23:21 2007
@@ -79,32 +79,40 @@
String address = request.getPathInfo() == null ? "" : request.getPathInfo();
ei.setAddress(address);
- ServletDestination d = (ServletDestination)transport.getDestination(ei);
+ ServletDestination d = (ServletDestination)transport.getDestinationForPath(ei.getAddress());
- if ("GET".equals(request.getMethod())) {
- updateDests(request);
- }
-
- if (d.getMessageObserver() == null) {
+ if (d == null) {
if (request.getRequestURI().endsWith("services")
|| request.getRequestURI().endsWith("services/")
|| StringUtils.isEmpty(request.getPathInfo())
|| "/".equals(request.getPathInfo())) {
+ updateDests(request);
generateServiceList(request, res);
} else {
- LOG.warning("Can't find the the request for " + request.getRequestURL() + "'s Observer ");
- generateNotFound(request, res);
+ d = checkRestfulRequest(request);
+ if (d == null || d.getMessageObserver() == null) {
+ LOG.warning("Can't find the the request for "
+ + request.getRequestURL() + "'s Observer ");
+ generateNotFound(request, res);
+ } else { // the request should be a restful service request
+ updateDests(request);
+ invokeDestination(request, res, d);
+ }
}
} else {
ei = d.getEndpointInfo();
Bus bus = cxfServlet.getBus();
if (null != request.getQueryString()
&& request.getQueryString().length() > 0
- && bus.getExtension(QueryHandlerRegistry.class) != null) {
+ && bus.getExtension(QueryHandlerRegistry.class) != null) {
String ctxUri = request.getPathInfo();
String baseUri = request.getRequestURL().toString()
+ "?" + request.getQueryString();
+ // update the EndPoint Address with request url
+ if ("GET".equals(request.getMethod())) {
+ updateDests(request);
+ }
for (QueryHandler qh : bus.getExtension(QueryHandlerRegistry.class).getHandlers()) {
if (qh.isRecognizedQuery(baseUri, ctxUri, ei)) {
@@ -129,6 +137,18 @@
}
}
+ private ServletDestination checkRestfulRequest(HttpServletRequest request) throws IOException {
+
+ String address = request.getPathInfo() == null ? "" : request.getPathInfo();
+
+ for (String path : transport.getDestinationsPaths()) {
+ if (address.startsWith(path)) {
+ return transport.getDestinationForPath(path);
+ }
+ }
+ return null;
+ }
+
private void generateServiceList(HttpServletRequest request, HttpServletResponse response)
throws IOException {
Collection<ServletDestination> destinations = transport.getDestinations();
@@ -178,6 +198,7 @@
inMessage.put(Message.PATH_INFO, request.getPathInfo());
inMessage.put(Message.QUERY_STRING, request.getQueryString());
inMessage.put(Message.CONTENT_TYPE, request.getContentType());
+ inMessage.put(Message.BASE_PATH, d.getAddress().getAddress().getValue());
inMessage.put(SecurityContext.class, new SecurityContext() {
public Principal getUserPrincipal() {
return request.getUserPrincipal();
Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Wed May 23 01:23:21 2007
@@ -69,6 +69,7 @@
}
public ServletDestination getDestinationForPath(String path) {
+ // to use the url context match
return destinations.get(getTrimmedPath(path));
}
Modified: incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-servlet.xml Wed May 23 01:23:21 2007
@@ -33,6 +33,7 @@
<value>http://schemas.xmlsoap.org/wsdl/soap/http</value>
<value>http://www.w3.org/2003/05/soap/bindings/HTTP/</value>
<value>http://cxf.apache.org/transports/http/configuration</value>
+ <value>http://schemas.xmlsoap.org/wsdl/soap/</value>
</set>
</property>
</bean>
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java Wed May 23 01:23:21 2007
@@ -0,0 +1,115 @@
+/**
+ * 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 org.apache.cxf.systest.servlet;
+
+
+
+import org.w3c.dom.Document;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.PutMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+import com.meterware.servletunit.ServletUnitClient;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.helpers.DOMUtils;
+import org.junit.Test;
+
+
+
+public class HttpBindingServletTest extends AbstractServletTest {
+
+ @Override
+ protected String getConfiguration() {
+ return "/org/apache/cxf/systest/servlet/web-restful.xml";
+ }
+
+ @Override
+ protected Bus createBus() throws BusException {
+ // don't set up the bus, let the servlet do it
+ return null;
+ }
+
+ @Test
+ public void testInvokingRestService() throws Exception {
+ ServletUnitClient client = newClient();
+ client.setExceptionsThrownOnErrorStatus(false);
+
+ WebRequest req =
+ new GetMethodQueryWebRequest("http://localhost/services/restful/customers");
+
+ WebResponse response = client.getResponse(req);
+ Document doc = DOMUtils.readXml(response.getInputStream());
+ assertNotNull(doc);
+
+ addNamespace("c", "http://cxf.apache.org/jra");
+ assertValid("/c:customers", doc);
+ assertValid("/c:customers/c:customer/c:id[text()='123']", doc);
+ assertValid("/c:customers/c:customer/c:name[text()='Dan Diephouse']", doc);
+
+ req = new GetMethodQueryWebRequest("http://localhost/services/restful/customers/123");
+ response = client.getResponse(req);
+ doc = DOMUtils.readXml(response.getInputStream());
+ assertNotNull(doc);
+
+ assertValid("/c:customer", doc);
+ assertValid("/c:customer/c:id[text()='123']", doc);
+ assertValid("/c:customer/c:name[text()='Dan Diephouse']", doc);
+
+ // Try invalid customer
+ req = new GetMethodQueryWebRequest("http://localhost/services/restful/customers/0");
+ response = client.getResponse(req);
+
+ assertEquals("Expect the wrong response code", response.getResponseCode(), 500);
+ doc = DOMUtils.readXml(response.getInputStream());
+ assertNotNull(doc);
+
+ assertValid("//c:CustomerNotFoundDetails", doc);
+
+ PostMethodWebRequest postReq =
+ new PostMethodWebRequest("http://localhost/services/restful/customers",
+ getClass().getResourceAsStream("add.xml"),
+ "text/xml; charset=UTF-8");
+ response = client.getResponse(postReq);
+ doc = DOMUtils.readXml(response.getInputStream());
+ assertNotNull(doc);
+ assertValid("/c:addCustomer", doc);
+
+ PutMethodWebRequest putReq =
+ new PutMethodWebRequest("http://localhost/services/restful/customers/123",
+ getClass().getResourceAsStream("update.xml"),
+ "text/xml; charset=UTF-8");
+ response = client.getResponse(putReq);
+ doc = DOMUtils.readXml(response.getInputStream());
+ assertNotNull(doc);
+ assertValid("/c:updateCustomer", doc);
+
+ // Get the updated document
+ req = new GetMethodQueryWebRequest("http://localhost/services/restful/customers/123");
+ response = client.getResponse(req);
+ doc = DOMUtils.readXml(response.getInputStream());
+ assertNotNull(doc);
+
+ assertValid("/c:customer", doc);
+ assertValid("/c:customer/c:id[text()='123']", doc);
+ assertValid("/c:customer/c:name[text()='Danno Manno']", doc);
+ }
+}
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/SpringServletTest.java Wed May 23 01:23:21 2007
@@ -23,6 +23,7 @@
import com.meterware.httpunit.PostMethodWebRequest;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
+import com.meterware.servletunit.ServletUnitClient;
import org.apache.cxf.Bus;
import org.apache.cxf.BusException;
@@ -69,4 +70,49 @@
assertValid("/s:Envelope/s:Body", doc);
assertValid("//h:sayHiResponse", doc);
}
+
+ @Test
+ public void testGreetMeGetRequest() throws Exception {
+ ServletUnitClient client = newClient();
+ client.setExceptionsThrownOnErrorStatus(true);
+
+ WebRequest req =
+ new GetMethodQueryWebRequest("http://localhost/services/Greeter/greetMe?"
+ + "requestType=hello");
+
+ WebResponse response = client.getResponse(req);
+ Document doc = DOMUtils.readXml(response.getInputStream());
+ addNamespace("h", "http://apache.org/hello_world_soap_http/types");
+ assertValid("/s:Envelope/s:Body", doc);
+ assertValid("//h:greetMeResponse", doc);
+
+ req =
+ new GetMethodQueryWebRequest("http://localhost/services/Greeter1/greetMe?"
+ + "requestType=hello");
+
+ response = client.getResponse(req);
+ doc = DOMUtils.readXml(response.getInputStream());
+ addNamespace("h", "http://apache.org/hello_world_soap_http/types");
+ assertValid("/s:Envelope/s:Body", doc);
+ assertValid("//h:greetMeResponse", doc);
+ }
+
+
+ @Test
+ public void testGetWSDL() throws Exception {
+ ServletUnitClient client = newClient();
+ client.setExceptionsThrownOnErrorStatus(true);
+
+ WebRequest req =
+ new GetMethodQueryWebRequest("http://localhost/services/Greeter?wsdl");
+
+ WebResponse res = client.getResponse(req);
+ assertEquals(200, res.getResponseCode());
+ assertEquals("text/xml", res.getContentType());
+ assertTrue("the wsdl should contain the opertion greetMe",
+ res.getText().contains("<wsdl:operation name=\"greetMe\">"));
+
+ }
+
+
}
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml Wed May 23 01:23:21 2007
@@ -0,0 +1,22 @@
+<?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.
+-->
+<customer xmlns="http://cxf.apache.org/jra">
+<name>Hadrian</name>
+</customer>
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/add.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml Wed May 23 01:23:21 2007
@@ -0,0 +1,48 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+ <bean id="JaxWsServiceFactoryBean" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
+ <property name="wrapped" value="false"/>
+ </bean>
+
+ <bean id="greeterServerFactory"
+ class="org.apache.cxf.jaxws.JaxWsServerFactoryBean" init-method="create">
+ <property name="serviceClass" value="org.apache.cxf.customer.bare.CustomerService" />
+ <property name="serviceBean">
+ <bean class="org.apache.cxf.customer.bare.CustomerService"/>
+ </property>
+ <property name="address" value="/services/restful"/>
+ <property name="bus" ref="cxf"/>
+ <property name="bindingId" value="http://apache.org/cxf/binding/http"/>
+ <property name="serviceFactory" ref="JaxWsServiceFactoryBean"/>
+ </bean>
+
+</beans>
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/spring.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/spring.xml?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/spring.xml (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/spring.xml Wed May 23 01:23:21 2007
@@ -26,8 +26,10 @@
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
<bean id="greeterServerFactory"
class="org.apache.cxf.jaxws.JaxWsServerFactoryBean" init-method="create">
<property name="serviceClass" value="org.apache.hello_world_soap_http.GreeterImpl" />
@@ -36,6 +38,7 @@
</property>
<property name="address" value="/services/Greeter"/>
<property name="bus" ref="cxf"/>
+ <property name="bindingId" value="http://apache.org/cxf/binding/http"/>
</bean>
<jaxws:endpoint id="endpoint1"
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml Wed May 23 01:23:21 2007
@@ -0,0 +1,23 @@
+<?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.
+-->
+<customer xmlns="http://cxf.apache.org/jra" xmlns:ns2="http://www.w3.org/2005/08/addressing/wsdl">
+<id>123</id>
+<name>Danno Manno</name>
+</customer>
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/update.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml Wed May 23 01:23:21 2007
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<!--
+ 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.
+-->
+
+<web-app>
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath:org/apache/cxf/systest/servlet/restful_service.xml
+ </param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener
+ </listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+ <servlet-class>
+ org.apache.cxf.transport.servlet.CXFServlet
+ </servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+
+</web-app>
\ No newline at end of file
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/web-restful.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/testutils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/pom.xml?view=diff&rev=540879&r1=540878&r2=540879
==============================================================================
--- incubator/cxf/trunk/testutils/pom.xml (original)
+++ incubator/cxf/trunk/testutils/pom.xml Wed May 23 01:23:21 2007
@@ -20,7 +20,11 @@
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.codehaus.jra</groupId>
+ <artifactId>jra</artifactId>
+ <version>1.0-alpha-3</version>
+ </dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java Wed May 23 01:23:21 2007
@@ -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 org.apache.cxf.customer;
+
+import javax.xml.bind.annotation.XmlRootElement;
+// START SNIPPET: bean
+@XmlRootElement
+public class Customer {
+ private long id;
+ private String name;
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
+// END SNIPPET: bean
\ No newline at end of file
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java Wed May 23 01:23:21 2007
@@ -0,0 +1,35 @@
+/**
+ * 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 org.apache.cxf.customer;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "CustomerNotFoundDetails")
+public class CustomerNotFoundDetails {
+ private long id;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+}
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundDetails.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java Wed May 23 01:23:21 2007
@@ -0,0 +1,36 @@
+/**
+ * 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 org.apache.cxf.customer;
+
+import javax.xml.ws.WebFault;
+
+
+@WebFault
+public class CustomerNotFoundFault extends Exception {
+ private CustomerNotFoundDetails details;
+
+ public CustomerNotFoundFault(CustomerNotFoundDetails details) {
+ super();
+ this.details = details;
+ }
+
+ public CustomerNotFoundDetails getFaultInfo() {
+ return details;
+ }
+}
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/CustomerNotFoundFault.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java Wed May 23 01:23:21 2007
@@ -0,0 +1,39 @@
+/**
+ * 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 org.apache.cxf.customer;
+
+import java.util.Collection;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+// START SNIPPET: bean
+@XmlRootElement
+public class Customers {
+ private Collection<Customer> customers;
+
+ public Collection<Customer> getCustomer() {
+ return customers;
+ }
+
+ public void setCustomer(Collection<Customer> c) {
+ this.customers = c;
+ }
+}
+// END SNIPPET: bean
\ No newline at end of file
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/Customers.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java Wed May 23 01:23:21 2007
@@ -0,0 +1,103 @@
+/**
+ * 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 org.apache.cxf.customer.bare;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import org.apache.cxf.customer.Customer;
+import org.apache.cxf.customer.CustomerNotFoundDetails;
+import org.apache.cxf.customer.CustomerNotFoundFault;
+import org.apache.cxf.customer.Customers;
+import org.codehaus.jra.Delete;
+import org.codehaus.jra.Get;
+import org.codehaus.jra.HttpResource;
+import org.codehaus.jra.Post;
+import org.codehaus.jra.Put;
+
+// END SNIPPET: service
+@WebService(targetNamespace = "http://cxf.apache.org/jra")
+public class CustomerService {
+ long currentId = 1;
+ Map<Long, Customer> customers = new HashMap<Long, Customer>();
+
+ public CustomerService() {
+ Customer customer = createCustomer();
+ customers.put(customer.getId(), customer);
+ }
+
+ @Get
+ @HttpResource(location = "/customers")
+ @WebMethod
+ public Customers getCustomers(@WebParam(name = "GetCustomers") GetCustomers req) {
+ Customers cbean = new Customers();
+ cbean.setCustomer(customers.values());
+ return cbean;
+ }
+
+ @Get
+ @HttpResource(location = "/customers/{id}")
+ @WebMethod
+ public Customer getCustomer(@WebParam(name = "GetCustomer") GetCustomer getCustomer)
+ throws CustomerNotFoundFault {
+ Customer c = customers.get(getCustomer.getId());
+ if (c == null) {
+ CustomerNotFoundDetails details = new CustomerNotFoundDetails();
+ details.setId(getCustomer.getId());
+ throw new CustomerNotFoundFault(details);
+ }
+ return c;
+ }
+
+ @Put
+ @HttpResource(location = "/customers/{id}")
+ @WebMethod
+ public void updateCustomer(@WebParam(name = "customer") Customer c) {
+ customers.put(c.getId(), c);
+ }
+
+ @Post
+ @HttpResource(location = "/customers")
+ @WebMethod
+ public void addCustomer(@WebParam(name = "customer") Customer c) {
+ long id = ++currentId;
+ c.setId(id);
+
+ customers.put(id, c);
+ }
+
+ @Delete
+ @HttpResource(location = "/customers/{id}")
+ @WebMethod
+ public void deleteCustomer(long id) {
+ customers.remove(id);
+ }
+
+ final Customer createCustomer() {
+ Customer c = new Customer();
+ c.setName("Dan Diephouse");
+ c.setId(123);
+ return c;
+ }
+}
+// END SNIPPET: service
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java Wed May 23 01:23:21 2007
@@ -0,0 +1,35 @@
+/**
+ * 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 org.apache.cxf.customer.bare;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "GetCustomer")
+public class GetCustomer {
+ private long id;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+}
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java Wed May 23 01:23:21 2007
@@ -0,0 +1,26 @@
+/**
+ * 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 org.apache.cxf.customer.bare;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "GetCustomers")
+public class GetCustomers {
+
+}
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/GetCustomers.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java Wed May 23 01:23:21 2007
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ */
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://cxf.apache.org/jra",
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.customer.bare;
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java Wed May 23 01:23:21 2007
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ */
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://cxf.apache.org/jra",
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.customer;
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java Wed May 23 01:23:21 2007
@@ -0,0 +1,94 @@
+/**
+ * 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 org.apache.cxf.customer.wraped;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import org.apache.cxf.customer.Customer;
+import org.apache.cxf.customer.Customers;
+import org.codehaus.jra.Delete;
+import org.codehaus.jra.Get;
+import org.codehaus.jra.HttpResource;
+import org.codehaus.jra.Post;
+import org.codehaus.jra.Put;
+
+// END SNIPPET: service
+@WebService(targetNamespace = "http://cxf.apache.org/jra")
+public class CustomerService {
+ long currentId = 1;
+ Map<Long, Customer> customers = new HashMap<Long, Customer>();
+
+ public CustomerService() {
+ Customer customer = createCustomer();
+ customers.put(customer.getId(), customer);
+ }
+
+ @Get
+ @HttpResource(location = "/customers")
+ @WebMethod
+ public Customers getCustomers() {
+ Customers cbean = new Customers();
+ cbean.setCustomer(customers.values());
+ return cbean;
+ }
+
+ @Get
+ @HttpResource(location = "/customers/{id}")
+ @WebMethod
+ public Customer getCustomer(@WebParam(name = "id") Long id) {
+ return customers.get(id);
+ }
+
+ @Put
+ @HttpResource(location = "/customers/{id}")
+ @WebMethod
+ public void updateCustomer(@WebParam(name = "id") String id, Customer c) {
+ customers.put(c.getId(), c);
+ }
+
+ @Post
+ @HttpResource(location = "/customers")
+ @WebMethod
+ public void addCustomer(@WebParam(name = "customer") Customer c) {
+ long id = ++currentId;
+ c.setId(id);
+
+ customers.put(id, c);
+ }
+
+ @Delete
+ @HttpResource(location = "/customers/{id}")
+ @WebMethod
+ public void deleteCustomer(String id) {
+ customers.remove(new Long(id));
+ }
+
+ final Customer createCustomer() {
+ Customer c = new Customer();
+ c.setName("Dan Diephouse");
+ c.setId(123);
+ return c;
+ }
+}
+// END SNIPPET: service
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/CustomerService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java?view=auto&rev=540879
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java (added)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java Wed May 23 01:23:21 2007
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ */
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://cxf.apache.org/jra",
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.customer.wraped;
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/wraped/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date