Hi On Thu, May 12, 2011 at 1:05 AM, yhu <[email protected]> wrote: > Hi, > > I create a Restful web service (POST method, application/xml) based on CXF. > It works well when I call it by posting XML data directly using HTTP tool. > However, I try to use CXF JAX-RS Client API, I get the SoapFault. > > The API code looks like: > > WebClient client = > WebClient.create("http://localhost:8080/myService/"); > String path = "myMethod"; > MyRequest request = new MyRequest (); > Response rp = > client.path(path).accept(MediaType.APPLICATION_XML).post(request); > > In the cxf log in server side, there is error: > > 2011-05-11 16:43:50,601 PDT [] [http-8080-1] WARN LogUtils - Interceptor > for {http://api.webservice.paygateway.com/}ParallelPayImplService has thrown > exception, unwinding now > org.apache.cxf.binding.soap.SoapFault: "http://api.webservice.xxx.com/", the > namespace on the "myRequest" element, is not a valid SOAP version. > at > org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:131) > at ... > > My question is: > > 1. Why SOAP related error happen when I try to call a Restful service. My > understanding is that Restful web service has no any relationship with SOAP. > > 2. Any idea to address the problem above? > Looks like you have a jaxws;endpoint address which catches "http://localhost:8080/myService/myMethod"
Can you check using a tcpmon or similar tool what is the difference between request URIs used by HTTP tool and WebClient ? How do you configure CXFServlet as well as jaxws and jaxrs endpoints ? Cheers, Sergey > Thanks > > -- > View this message in context: > http://cxf.547215.n5.nabble.com/CXF-Restful-Client-calls-causes-SoapFault-in-server-side-tp4388904p4388904.html > Sent from the cxf-user mailing list archive at Nabble.com. >
