You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by peterpeter <c_...@qualcomm.com> on 2008/08/21 06:15:33 UTC

Restful HTTP Binding: Wrapped Mode & Put Method

Hello,

I've modified the "restful_http_binding" apache CXF sample to use "wrapped
mode" instead of unwrapped.

In Client.java, I've changed the main() method to do a 'put' instead of a
'get', as follows (using commons-httpclient):

		PutMethod method = new PutMethod(url);
		method.setRequestBody("<?xml version=\"1.0\"
encoding=\"UTF-8\"?><updateCustomer
xmlns=\"p\"><customer><id>57</id><name>Jaba</name></customer></updateCustomer>");

		httpClient.executeMethod(method);
		System.out.println(method.getStatusLine());
		System.out.println(new String(method.getResponseBody()));

Basically, following the "Wrapped vs. Unwrapped Mode" section of the HTTP
Binding document on the CXF wiki, I believe I need to wrap the "customer"
element with an "updateCustomer" element since I enabled wrapped mode.

Whether or not I wrap "customer" with an "updateCustomer", I get the same
error on the client:

HTTP/1.1 500 Internal Server Error
<ns1:XMLFault
xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:
ns1="http://cxf.apache.org/bindings/xformat">java.lang.NullPointerException</ns1:faultstring></ns1:X
MLFault>

which appears to be because the updateCustomer() method is invoked on the
server, but with a <null> customer.

Is this a known issue? Anybody have an idea what the XML needs to look like
for the JAXB/CXF unmarshalling to work properly?

Thanks,

Peter
-- 
View this message in context: http://www.nabble.com/Restful-HTTP-Binding%3A-Wrapped-Mode---Put-Method-tp19082206p19082206.html
Sent from the cxf-user mailing list archive at Nabble.com.