Hi,

You can use some code like
Client myClient = org.apache.cxf.frontend.ClientProxy.getClient(client);
HTTPConduit http = (HTTPConduit) myClient.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setContentType("application/soap+xml");
http.setClient(httpClientPolicy);

Freeman
On 2011-12-13, at 下午5:14, manoj_cxf wrote:

Hi,

How to set content type in CXF client code for web service.

Below is my code, which send content type as text/xml while invoking web
wervice.
I have to have content type as "application/soap+xml; charset=utf-8".

How can i achieve this in this code.

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

                        factory.getInInterceptors().add(new 
LoggingInInterceptor());
                        factory.getOutInterceptors().add(new 
LoggingOutInterceptor());
                        factory.setServiceClass(IShuiOnService.class);
                
factory.setAddress("http://localhost/Test/TestAppService/TestService.svc ");

                        factory.setUsername("username");
                        factory.setPassword("pass");
                        IShuiOnService client = (IShuiOnService) 
factory.create();
                        String message = client.getUserPoints("12/12/2011");
                        System.out.println("Server said: " + message);



thanks,
Manoj

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Setting-Content-type-in-CXF-Client-tp5070865p5070865.html
Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com









Reply via email to