Author: jliu
Date: Mon Apr 23 00:00:22 2007
New Revision: 531355
URL: http://svn.apache.org/viewvc?view=rev&rev=531355
Log:
CXF-578 (Exception occured when run the sample restful_dispatch client). It
appears to me that JAX-WS Dispatch is not appropriate for HTTP GET, the demo is
fixed by not calling Dispatch for HTTP GET.
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/restful_dispatch/src/demo/restful/client/Client.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/restful_dispatch/src/demo/restful/client/Client.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/restful_dispatch/src/demo/restful/client/Client.java?view=diff&rev=531355&r1=531354&r2=531355
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/restful_dispatch/src/demo/restful/client/Client.java
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/restful_dispatch/src/demo/restful/client/Client.java
Mon Apr 23 00:00:22 2007
@@ -69,7 +69,7 @@
source = new StreamSource(in);
printSource(source);
- // Sent HTTP GET request to query customer info using JAX-WS Dispatch
+ // Sent HTTP POST request to update customer info using JAX-WS Dispatch
URI endpointURI = new URI(endpointAddress.toString());
String path = null;
if (endpointURI != null) {
@@ -78,18 +78,10 @@
Service service = Service.create(serviceName);
service.addPort(portName, HTTPBinding.HTTP_BINDING, endpointAddress);
- Dispatch<DOMSource> dispatcher = service.createDispatch(portName,
+ Dispatch<DOMSource> dispatcher = service.createDispatch(portName,
DOMSource.class, Service.Mode.PAYLOAD);
Map<String, Object> requestContext = dispatcher.getRequestContext();
- requestContext.put(MessageContext.HTTP_REQUEST_METHOD, new
String("GET"));
- requestContext.put(MessageContext.QUERY_STRING, "id=1234");
- requestContext.put(MessageContext.PATH_INFO, path);
- System.out.println("Invoking through HTTP GET to query customer using
JAX-WS Dispatch");
- DOMSource returnSource = dispatcher.invoke(null);
- printSource(returnSource);
-
- // Sent HTTP POST request to update customer info using JAX-WS Dispatch
Client client = new Client();
InputStream is =
client.getClass().getResourceAsStream("CustomerJohnReq.xml");
Document doc = XMLUtils.parse(is);
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java?view=diff&rev=531355&r1=531354&r2=531355
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
Mon Apr 23 00:00:22 2007
@@ -112,6 +112,7 @@
@Test
@Ignore
+ //This test should be removed, as JAX-WS Dispatch is not appropriate for
being used by HTTP GET.
public void testHttpGETDispatchHTTPBinding() throws Exception {
Service service = Service.create(serviceName);
URI endpointURI = new URI(endpointAddress);