i don't think you can send a Message instance that way. But why do you need to send it out from your application that way?
If you just need to send and receive a generic message, you can use the jaxws dispatcher/provider approach. http://cxf.apache.org/docs/jax-ws-dispatch-api.html http://cxf.apache.org/docs/provider-services.html 2015-11-19 15:17 GMT+01:00 tho huynh ngoc <[email protected]>: > Hi, > > I want to send an org.apache.cxf.message.Message object via CXF Jax-ws. For > example: > > 1. > > A service declared: > > @WebServicepublic interface HelloWorld { > void send(Message msg);} > > 2. > > Implementation of this service: > > public class HelloWorldImpl implements HelloWorld { > public void send(Message msg) { > System.out.println("receives msg id:" +((MessageImpl)msg).getId()); > }} > > 3. > > Server: > > HelloWorldImpl implementor = new > HelloWorldImpl();JaxWsServerFactoryBean svrFactory1 = new > JaxWsServerFactoryBean(); > svrFactory1.setServiceClass(HelloWorld.class); > svrFactory1.setAddress("http://192.168.56.1:9000/HelloWorld"); > svrFactory1.setServiceBean(implementor); > org.apache.cxf.endpoint.Server server1 = svrFactory1.create(); > server1.start(); > > 4. > > Client: > > JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); > factory.setAddress("http://192.168.56.1:9000/HelloWorld");HelloWorld > client = factory.create(HelloWorld.class);Message msg = new > MessageImpl(); > msg.setId("abc"); > client.send(msg); > > > I receive an error when running as follows: > > Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault > occurred while processing. > at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:160) > at com.sun.proxy.$Proxy37.sayHiToUser(Unknown Source) > at objecttype.Client.main(Client.java:60) > > Caused by: org.apache.cxf.binding.soap.SoapFault: Fault occurred while > processing........ > > How to correct this error ? the pojo class that i want to send in CXF: > org.apache.cxf.message.MessageImpl > > Regards,
