Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
Mon Oct 23 11:52:16 2006
@@ -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.binding.http.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.binding.http.Customer;
+import org.apache.cxf.binding.http.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
[EMAIL PROTECTED](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) {
+ return customers.get(new Long(getCustomer.getId()));
+ }
+
+ @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(String id) {
+ customers.remove(new Long(id));
+ }
+
+ Customer createCustomer() {
+ Customer c = new Customer();
+ c.setName("Dan Diephouse");
+ c.setId(123);
+ return c;
+ }
+}
+// END SNIPPET: service
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
Mon Oct 23 11:52:16 2006
@@ -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.binding.http.bare;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
[EMAIL PROTECTED](name = "GetCustomer")
+public class GetCustomer {
+ private String id;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+}
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
Mon Oct 23 11:52:16 2006
@@ -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.binding.http.bare;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
[EMAIL PROTECTED](name = "GetCustomers")
+public class GetCustomers {
+
+}
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/GetCustomers.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
Mon Oct 23 11:52:16 2006
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<customer xmlns="http://cxf.apache.org/jra">
+<name>Hadrian</name>
+</customer>
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/add.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb
Mon Oct 23 11:52:16 2006
@@ -0,0 +1 @@
+Customer
\ No newline at end of file
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/index.jaxb
------------------------------------------------------------------------------
svn:executable = *
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
Mon Oct 23 11:52:16 2006
@@ -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.
+ */
[EMAIL PROTECTED](namespace = "http://cxf.apache.org/jra",
+ elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.binding.http.bare;
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
Mon Oct 23 11:52:16 2006
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
\ No newline at end of file
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/update.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
Mon Oct 23 11:52:16 2006
@@ -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.
+ */
[EMAIL PROTECTED](namespace = "http://cxf.apache.org/jra",
+ elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.binding.http;
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
Mon Oct 23 11:52:16 2006
@@ -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.binding.http.wrapped;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import org.apache.cxf.binding.http.Customer;
+import org.apache.cxf.binding.http.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
[EMAIL PROTECTED](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(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));
+ }
+
+ Customer createCustomer() {
+ Customer c = new Customer();
+ c.setName("Dan Diephouse");
+ c.setId(123);
+ return c;
+ }
+}
+// END SNIPPET: service
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/CustomerService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
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=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
Mon Oct 23 11:52:16 2006
@@ -0,0 +1,128 @@
+/**
+ * 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.binding.http.wrapped;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.http.AbstractRestTest;
+import org.apache.cxf.binding.http.HttpBindingFactory;
+import org.apache.cxf.binding.http.HttpBindingInfoFactoryBean;
+import org.apache.cxf.binding.http.URIMapper;
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.factory.ServerFactoryBean;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.transport.http.JettyHTTPDestination;
+
+public class WrappedServiceTest extends AbstractRestTest {
+ public void testCreation() throws Exception {
+ BindingFactoryManager bfm =
getBus().getExtension(BindingFactoryManager.class);
+ bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, new
HttpBindingFactory());
+
+ JaxWsServiceFactoryBean sf = new JaxWsServiceFactoryBean();
+ sf.setBus(getBus());
+ sf.setServiceClass(CustomerService.class);
+ sf.setWrapped(true);
+
+ Service service = sf.create();
+ assertNotNull(service.getServiceInfo());
+ assertEquals("http://cxf.apache.org/jra",
service.getName().getNamespaceURI());
+
+ HttpBindingInfoFactoryBean jraFactory = new
HttpBindingInfoFactoryBean();
+
+ ServerFactoryBean svrFactory = new ServerFactoryBean();
+ svrFactory.setServiceFactory(sf);
+ svrFactory.setBus(getBus());
+ svrFactory.setBindingFactory(jraFactory);
+ svrFactory.setAddress("http://localhost:9001/");
+ svrFactory.setTransportId("http://schemas.xmlsoap.org/wsdl/http/");
+ svrFactory.setStart(false);
+
+ ServerImpl svr = (ServerImpl) svrFactory.create();
+ ((JettyHTTPDestination)
svr.getDestination()).setContextMatchStrategy("stem");
+ svr.start();
+
+ URIMapper mapper = (URIMapper) service.get(URIMapper.class.getName());
+ assertNotNull(mapper);
+
+ BindingOperationInfo bop = mapper.getOperation("/customers", "GET",
null);
+ assertNotNull(bop);
+ assertEquals("getCustomers", bop.getName().getLocalPart());
+ assertTrue(bop.isUnwrappedCapable());
+
+ bop = mapper.getOperation("/customers", "POST", null);
+ assertNotNull(bop);
+ assertEquals("addCustomer", bop.getName().getLocalPart());
+
+ bop = mapper.getOperation("/customers/123", "GET", null);
+ assertNotNull(bop);
+ assertEquals("getCustomer", bop.getName().getLocalPart());
+
+ bop = mapper.getOperation("/customers/123", "PUT", null);
+ assertNotNull(bop);
+ assertEquals("updateCustomer", bop.getName().getLocalPart());
+
+ // TEST POST/GETs
+
+ Document res = get("http://localhost:9001/customers");
+ assertNotNull(res);
+ DOMUtils.writeXml(res, System.out);
+
+ addNamespace("c", "http://cxf.apache.org/jra");
+ assertValid("/c:getCustomersResponse/c:customers", res);
+
assertValid("/c:getCustomersResponse/c:customers/c:customer/c:id[text()='123']",
res);
+
assertValid("/c:getCustomersResponse/c:customers/c:customer/c:name[text()='Dan
Diephouse']", res);
+
+ res = get("http://localhost:9001/customers/123");
+ assertNotNull(res);
+ DOMUtils.writeXml(res, System.out);
+
+ addNamespace("c", "http://cxf.apache.org/jra");
+ assertValid("/c:getCustomerResponse/c:customer", res);
+ assertValid("/c:getCustomerResponse/c:customer/c:id[text()='123']",
res);
+ assertValid("/c:getCustomerResponse/c:customer/c:name[text()='Dan
Diephouse']", res);
+
+ res = put("http://localhost:9001/customers/123", "update.xml");
+ assertNotNull(res);
+ DOMUtils.writeXml(res, System.out);
+
+ assertValid("/c:updateCustomerResponse", res);
+
+ res = post("http://localhost:9001/customers", "add.xml");
+ assertNotNull(res);
+ DOMUtils.writeXml(res, System.out);
+
+ assertValid("/c:addCustomerResponse", res);
+
+ // Get the updated document
+ res = get("http://localhost:9001/customers/123");
+ assertNotNull(res);
+ DOMUtils.writeXml(res, System.out);
+
+ assertValid("/c:getCustomerResponse/c:customer", res);
+ assertValid("/c:getCustomerResponse/c:customer/c:id[text()='123']",
res);
+ assertValid("/c:getCustomerResponse/c:customer/c:name[text()='Danno
Manno']", res);
+
+ svr.stop();
+ }
+
+}
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
Mon Oct 23 11:52:16 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<addCustomer xmlns="http://cxf.apache.org/jra">
+<customer>
+<name>Hadrian</name>
+</customer>
+</addCustomer>
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/add.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb
Mon Oct 23 11:52:16 2006
@@ -0,0 +1 @@
+Customer
\ No newline at end of file
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/index.jaxb
------------------------------------------------------------------------------
svn:executable = *
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
Mon Oct 23 11:52:16 2006
@@ -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.
+ */
[EMAIL PROTECTED](namespace = "http://cxf.apache.org/jra",
+ elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.apache.cxf.binding.http.wrapped;
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/package-info.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml?view=auto&rev=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
(added)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
Mon Oct 23 11:52:16 2006
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<updateCustomer xmlns="http://cxf.apache.org/jra">
+<customer>
+<id>123</id>
+<name>Danno Manno</name>
+</customer>
+</updateCustomer>
\ No newline at end of file
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/update.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/cxf/trunk/rt/bindings/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/pom.xml?view=diff&rev=467080&r1=467079&r2=467080
==============================================================================
--- incubator/cxf/trunk/rt/bindings/pom.xml (original)
+++ incubator/cxf/trunk/rt/bindings/pom.xml Mon Oct 23 11:52:16 2006
@@ -37,6 +37,7 @@
<modules>
<module>soap</module>
<module>xml</module>
+ <module>http</module>
</modules>
</project>
Modified:
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java?view=diff&rev=467080&r1=467079&r2=467080
==============================================================================
---
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
(original)
+++
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptor.java
Mon Oct 23 11:52:16 2006
@@ -30,6 +30,7 @@
import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
import org.apache.cxf.interceptor.BareOutInterceptor;
import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.WrappedOutInterceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.service.model.BindingMessageInfo;
@@ -44,6 +45,7 @@
public XMLMessageOutInterceptor() {
super();
setPhase(Phase.MARSHAL);
+ addAfter(WrappedOutInterceptor.class.getName());
}
public void handleMessage(Message message) throws Fault {
@@ -69,7 +71,7 @@
if (rootInModel == null) {
rootInModel = boi.getName();
}
- if (mi.getMessageParts().size() == 0) {
+ if (mi.getMessageParts().size() == 0 && !boi.isUnwrapped()) {
// write empty operation qname
writeMessage(message, rootInModel, false);
} else {
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java?view=diff&rev=467080&r1=467079&r2=467080
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
Mon Oct 23 11:52:16 2006
@@ -61,6 +61,14 @@
}
message.setContent(XMLStreamWriter.class, writer);
+
+ message.getInterceptorChain().doIntercept(message);
+
+ try {
+ writer.close();
+ } catch (XMLStreamException e) {
+ throw new Fault(new
org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e);
+ }
}
protected XMLOutputFactory getXMLOutputFactory() {
Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?view=diff&rev=467080&r1=467079&r2=467080
==============================================================================
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
(original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
Mon Oct 23 11:52:16 2006
@@ -53,6 +53,7 @@
import org.apache.cxf.service.model.SchemaInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.cxf.service.model.TypeInfo;
+import org.apache.cxf.wsdl11.WSDLServiceBuilder;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
@@ -78,13 +79,12 @@
}
public JAXBDataBinding(Class<?> cls) throws JAXBException {
- this();
+ this();
context = JAXBEncoderDecoder.createJAXBContextForClass(cls);
reader.setJAXBContext(context);
writer.setJAXBContext(context);
}
-
public void setContext(JAXBContext ctx) {
context = ctx;
reader.setJAXBContext(context);
@@ -100,8 +100,8 @@
}
public Map<String, SchemaInfo> getSchemas(ServiceInfo serviceInfo) {
- Collection<String> schemaResources =
CastUtils.cast(serviceInfo.getProperty(SCHEMA_RESOURCE,
- List.class), String.class);
+ Collection<String> schemaResources = CastUtils
+ .cast(serviceInfo.getProperty(SCHEMA_RESOURCE, List.class),
String.class);
return loadSchemas(schemaResources);
}
@@ -159,9 +159,16 @@
}
public void initialize(ServiceInfo serviceInfo) {
- JAXBServiceModelInitializer initializer = new
JAXBServiceModelInitializer(serviceInfo);
- initializer.walk();
-
+ XmlSchemaCollection col = (XmlSchemaCollection)serviceInfo
+ .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_LIST);
+
+ if (col != null) {
+ // someone has already filled in the types
+ return;
+ }
+
+ col = new XmlSchemaCollection();
+
try {
TypeInfo typeInfo = serviceInfo.getTypeInfo();
if (typeInfo == null) {
@@ -170,25 +177,30 @@
}
for (DOMResult r : generateJaxbSchemas()) {
- Document d = (Document) r.getNode();
+ Document d = (Document)r.getNode();
String ns =
d.getDocumentElement().getAttribute("targetNamespace");
if (ns == null) {
ns = "";
}
-
+
// Don't include WS-Addressing bits
if ("http://www.w3.org/2005/08/addressing/wsdl".equals(ns)) {
continue;
}
-
+
SchemaInfo schema = new SchemaInfo(typeInfo, ns);
schema.setElement(d.getDocumentElement());
+ col.read(d.getDocumentElement());
}
} catch (IOException e) {
throw new ServiceConstructionException(new
Message("SCHEMA_GEN_EXC", BUNDLE), e);
}
+
+ serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SCHEMA_LIST, col);
+ JAXBServiceModelInitializer initializer = new
JAXBServiceModelInitializer(serviceInfo, col);
+ initializer.walk();
+
}
-
private List<DOMResult> generateJaxbSchemas() throws IOException {
final List<DOMResult> results = new ArrayList<DOMResult>();
Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?view=diff&rev=467080&r1=467079&r2=467080
==============================================================================
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
(original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
Mon Oct 23 11:52:16 2006
@@ -47,6 +47,7 @@
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.validation.Schema;
+import javax.xml.ws.Holder;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.WebEndpoint;
@@ -101,7 +102,7 @@
return getValidClass(cls.getComponentType());
}
- if (cls == Object.class || cls == String.class) {
+ if (cls == Object.class || cls == String.class || cls == Holder.class)
{
cls = null;
} else if (cls.isPrimitive() || cls.isInterface() ||
cls.isAnnotation()) {
cls = null;
Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBServiceModelInitializer.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBServiceModelInitializer.java?view=diff&rev=467080&r1=467079&r2=467080
==============================================================================
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBServiceModelInitializer.java
(original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBServiceModelInitializer.java
Mon Oct 23 11:52:16 2006
@@ -24,21 +24,25 @@
import javax.xml.namespace.QName;
import com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader;
-import com.sun.xml.bind.v2.model.core.ElementInfo;
+import com.sun.xml.bind.v2.model.core.Element;
import com.sun.xml.bind.v2.model.core.NonElement;
import com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder;
import org.apache.cxf.service.ServiceModelVisitor;
import org.apache.cxf.service.model.MessagePartInfo;
import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
/**
* Walks the service model and sets up the element/type names.
*/
class JAXBServiceModelInitializer extends ServiceModelVisitor {
- public JAXBServiceModelInitializer(ServiceInfo serviceInfo) {
+ private XmlSchemaCollection schemas;
+
+ public JAXBServiceModelInitializer(ServiceInfo serviceInfo,
XmlSchemaCollection col) {
super(serviceInfo);
+ schemas = col;
}
@Override
@@ -62,13 +66,16 @@
return;
}
- boolean isElement = typeInfo instanceof ElementInfo;
+ boolean isElement = typeInfo instanceof Element;
part.setElement(isElement);
if (isElement) {
- part.setElementQName(typeName);
+ QName name = ((Element) typeInfo).getElementName();
+ part.setElementQName(name);
+ part.setXmlSchema(schemas.getElementByQName(name));
} else {
part.setTypeQName(typeName);
+ part.setXmlSchema(schemas.getTypeByQName(typeName));
}
}
}