Hi Oliver,
I successfully called my service on server side :-)
The problem is that I extended SimpleJMSListener and this Object
creates "new" axis server, so it wasn't using mine already created,
my mistake :-)
Here's example what I do on server side.
When server side is started:
server = new AxisServer(new XMLStringProvider(wsdd));
When JMS message is received:
...
converts received message to bytestream
...
//Reference to my previously created server axis instance.
AxisServer server = MySimpleJMSListener.getAxisServer();
Message msg = new Message(in);
MessageContext msgContext = new MessageContext(server);
msgContext.setTargetService("MessageService");
msgContext.setRequestMessage( msg );
....
I have one more question: Do you incorporate in some way the
destination service when sending JMS message from client? Probably
add them as attribute part of JMSMessage?
How do you distinguish which service should be called if it receives
message from the same queue name?
Thanks for help.
Cheers,
Michal
______________________________________________________________
> Od: "Oliver Adler" <[EMAIL PROTECTED]>
> Komu: <[EMAIL PROTECTED]>
> CC:
> Datum: Thu, 13 Feb 2003 08:38:50 +0100
> Předmět: AW: AW: How to set JMS transport destination service
>
> Hi Michal,
>
> the client side and and jms part is correct (we do it the same
way). On the server side we have a AxisServer
> Instance which we invoke:
>
> ...
> FileProvider provider = new FileProvider(serverConfigFile);
>
> engine = new AxisServer(provider);
>
> ...
> //value is the string from jms
> MessageContext msgContext = new MessageContext(engine);
>
> Message msg = new Message(value.getBytes());
>
> msg.setMessageType(Message.REQUEST);
>
> msgContext.setRequestMessage( msg );
>
> msgContext.setTransportName(transportName);
>
> try
>
> {
>
> /* Invoke the Axis engine... */
>
> engine.invoke( msgContext );
>
> }
>
> catch( Exception e )
>
> {
>
> AxisFault fault = AxisFault.makeFault(e);
>
> msgContext.setResponseMessage( new Message(fault) );
>
> }
>
> /* Send it back along the wire... */
>
> msg = msgContext.getResponseMessage();
>
> String response = null;
>
> if (msg == null)
>
> {
>
> AxisFault fault = AxisFault.makeFault(new VRSAgentException("axis
response empty", VRSAgentException.SYSTEM_ERROR, null));
>
> msg = new Message(fault);
>
> }
>
> try
>
> {
>
> response = (String) msg.getSOAPPartAsString();
>
> }
>
> catch (AxisFault fault)
>
> {
>
> msg = new Message(fault);
>
> try
>
> {
>
> response = (String)msg.getSOAPPartAsString();
>
> }
>
> catch (AxisFault fault2)
>
> {
>
> response = fault2.dumpToString();
>
> }
>
> }
>
> return response;
>
> }
>
> The next step we did is to implement a transport specific handler.
Here we decide which service to invoke (we use a soap header) and
call the setTargetService on the messageContext with the name of the
service.
>
>
>
> As you can see in the code there is the MessageContext object. But
I'am not sure if you could call the setTargetService at this time.
>
> We used the code from the transport sample.
>
>
>
> I hope that brings some light.
>
>
>
> Regards
>
> Oliver
>
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
> Gesendet: Mi 12.02.2003 20.18 Uhr
> An: [EMAIL PROTECTED]
> Cc:
> Betreff: Re: AW: How to set JMS transport destination service
>
>
> Hi Oliver,
> thanks for response, but I'm not absolutely about setting
> messageContext.
>
> Where this message context should be set. I guess on the
server side,
> probably.
>
> In my opinion message lifetime looks like this:
>
> Client side
> -----------
> 1.Call object is created
> 2.Call object is set to use JMS transport layer, with provider
> factory and queue name specified.
> 3.SOAPMessage is created.
> 4.SOAPMessage is send to its destination (JMS queue) using
invoke
> function of Call object.
> 5.SOAPMessage is converted to JMS message when transporting.
>
> JMS Provider
> ------------
> 1. Message is stored in queue
>
> Server Part
> -----------
> 1.Message is retrieved from jms queue using JMSListener
> 2.Message is send to JMSWorker which converts JMS message
back to
> SOAP Message.
> 3.Context of the message is created
> 4.Service is restored from message context and called
>
> The problem is in the steps 3 and 4 of server side. The
> messagecontext is created using server axis instance and
there's no
> information about originating targetservice.
>
> So I think in this point you can assume that in particular
queue is
> just messages that should be sent to particular service. I
this case
> you can set to newly created messagecontext targetservice as
the name
> of service. But I've tried that solution too and seems to be
not
> working.
>
> Any other idea?
>
> Cheers,
> Michal
>
>
--------------------
Poslouchejte Radio Impuls a vyhrajte víkendy pro dva v evropských
metropolích. Více na Radiu Impuls a http://www.netimpuls.cz!