When a Destination receives a message at processStreamIo method
ex:
protected void processStreamIo(IoSession session, InputStream in,
OutputStream out) {
final MessageImpl m = new MessageImpl();
final Exchange exchange = new ExchangeImpl();
exchange.setDestination(MyDestination.this);
m.setDestination(MyDestination.this);
exchange.setInMessage(m);
m.setContent(InputStream.class, in);
out = new UDPDestinationOutputStream(out);
m.put(UDPConnectionInfo.class, new UDPConnectionInfo(session,
out, in));
queue.execute(new Runnable() {
public void run() {
//Here, i want to sent this m message to an
orther Destination
}
});
}
the message that i want to send contains information of ConnectionInfo, etc,
Regards,
HNT
2015-11-24 12:44 GMT+01:00 tho huynh ngoc <[email protected]>:
> When a Destination receives a message at processStreamIo method
> ex:
>
> protected void processStreamIo(IoSession session, InputStream in,
> OutputStream out) {
>
> final MessageImpl m = new MessageImpl();
> final Exchange exchange = new ExchangeImpl();
> exchange.setDestination(MyDestination.this);
> m.setDestination(MyDestination.this);
> exchange.setInMessage(m);
>
> m.setContent(InputStream.class, in);
> out = new UDPDestinationOutputStream(out);
> m.put(UDPConnectionInfo.class, new UDPConnectionInfo(session,
> out, in));
>
> queue.execute(new Runnable() {
> public void run() {
> //Here, i want to sent this m message to an
> orther Destination
>
> }
> });
> }
>
> 2015-11-24 12:19 GMT+01:00 Aki Yoshida <[email protected]>:
>
>> If you want to receive a message and route it to somewhere else based
>> on the content, one typical approach is to Apache Camel
>> (http://camel.apache.org) which supports all kinds of endpoints
>> including CXF and also various processing steps. In this case, your
>> application is a simple Camel route with a CXF consumer endpoint
>> (from) and a CXF producer endpoint (to).
>>
>> The question of whether to use the generic dispatch/provider API or
>> not depends on what kind of messages you want to process. Using the
>> generic API, you can send and receive arbitrary messages. But you need
>> to read and set the message content using some generic XML API. In
>> contrast, using the specifically typed API, you can automatically
>> restrict the structure of the message and read and set the structure
>> using its convenient get/setter methods.
>>
>> regards, aki
>>
>> 2015-11-23 18:04 GMT+01:00 tho huynh ngoc <[email protected]>:
>> > I would like to send a message received by my owns Destination (side A)
>> to
>> > another one (side B) (for approving my research problem). I don't know
>> if i
>> > can use jax-ws-dispatch-api ?
>> >
>> > Regards,
>> >
>> >
>> > 2015-11-20 10:49 GMT+01:00 Aki Yoshida <[email protected]>:
>> >
>> >> 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,
>> >>
>>
>
>