Very nice. Good to know. It'd be good to pull this info together &
publish it out somewhere (got a blog?) - I imagine it would be useful to
others!
Nice way to get 2-phase commit w/ a service if you can't do WS-AT yet.
-Brice
-----Original Message-----
From: Wayne Keenan [mailto:[EMAIL PROTECTED]
Sent: Friday, December 01, 2006 10:17 AM
To: [email protected]
Subject: Re: [xfire-user] Set JMSChannel replyTo
Sorry, that;s misleasding debug, as the reply-to isnt in the message
context.
Stopping the server and inspecting the message on the queue shows that
the JMS (cough, MQ) reply-to variable is set correctly.
On 01/12/06, Ruth, Brice D <[EMAIL PROTECTED]> wrote:
Hmm, odd. The DEBUG logs seem to indicate that the reply-to
still isn't being set ... good that its working, though! :)
1219 [main] DEBUG org.codehaus.xfire.transport.jms.JMSChannel -
msgctx.getProp(REPLY_TO):null
-----Original Message-----
From: Wayne Keenan [mailto:[EMAIL PROTECTED]
Sent: Friday, December 01, 2006 3:36 AM
To: [email protected]
Subject: Re: [xfire-user] Set JMSChannel replyTo
This works fine now. I had some (duplicate) server side test
code messing things up on the service registry side.
On 30/11/06, Wayne Keenan < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
It works, and I have discovered that this line in the
client:
((XFireProxy)
Proxy.getInvocationHandler(echo)).getClient().setEndpointUri("jms://ARSY
STEM_OUTBOUND");
sets the replyto queue. (see server log below)
I have added my own additional logging and have also
created and additional JMS sessions (1 'in', 1 'out') in JMSChannel to
get around the MQ asych error, I dont think this is a 'proper all
encompasing fix', it just solves my needs at the moment.
But, my problem at the moment is that the Service (in
this case Echo) does not seem to come accross:
client log:
719 [main] DEBUG org.codehaus.xfire.client.XFireProxy
- Method [echo] [hello]
719 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSTransport - Creating new channel
for uri: jms://ARSYSTEM_OUTBOUND
735 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel - DestName
:ARSYSTEM_OUTBOUND
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - adding handler
[EMAIL PROTECTED] to phase send
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - adding handler
[EMAIL PROTECTED] to phase
transport
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - adding handler
[EMAIL PROTECTED] to phase
post-invoke
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase
post-invoke
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking handler
org.codehaus.xfire.soap.handler.SoapSerializerHandler in phase
post-invoke
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase policy
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase user
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase transport
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking handler
org.codehaus.xfire.soap.handler.SoapActionOutHandler in phase transport
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase send
1094 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking handler
org.codehaus.xfire.handler.OutMessageSender in phase send
1219 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel -
ResponseURI:jms://ARSYSTEM_INBOUND?Echo
1219 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel - msgtxt:<soap:Envelope
xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> " xmlns:xsd="
http://www.w3.org/2001/XMLSchema " xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> "><soap:Body><echo xmlns="
http://test.xfire.codehaus.org"><in0>hello</in0></echo></soap:Body></soa
p:Envelope>
1219 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel -
corrid:11649244730150-704411791
1219 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel -
msgctx.getProp(REPLY_TO):null
1219 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel - selector=
1250 [main] INFO
org.codehaus.xfire.transport.jms.JMSChannel - Sent message: Source ID:
65B4422E-55DF-C388-8ABA-6D2E56F491E3 Destination: null JMSType: null
11407 [main] DEBUG org.codehaus.xfire.client.XFireProxy
- Result [null]
response:null
server log:
30/11/2006 22:07:53,171 DEBUG asyncDelivery2
JMSChannel.onMessage - recv msg=<soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
"><soap:Body><echo xmlns="
http://test.xfire.codehaus.org"><in0>hello</in0></echo></soap:Body></soa
p:Envelope>
30/11/2006 22:07:53,171 DEBUG asyncDelivery2
JMSChannel.onMessage - dest name=ARSYSTEM_INBOUND
30/11/2006 22:07:53,171 DEBUG asyncDelivery2
JMSChannel.onMessage - reply-to=queue:///ARSYSTEM_OUTBOUND
30/11/2006 22:07:53,171 DEBUG asyncDelivery2
DefaultEndpoint.onReceive - Received message to
jms://ARSYSTEM_INBOUND
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.addHandler - adding handler
[EMAIL PROTECTED]
to phase dispatch
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.addHandler - adding handler
[EMAIL PROTECTED] to phase
parse
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.addHandler
- adding handler
[EMAIL PROTECTED] to phase
pre-invoke
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.addHandler - adding handler
[EMAIL PROTECTED]
to phase dispatch
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.addHandler - adding handler
[EMAIL PROTECTED]
to phase dispatch
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.addHandler - adding handler
[EMAIL PROTECTED] to phase dispatch
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.invoke - Invoking phase transport
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.invoke - Invoking phase parse
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.invoke
- Invoking handler
org.codehaus.xfire.soap.handler.ReadHeadersHandler in
phase parse
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.invoke - Invoking phase pre-dispatch
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.invoke
- Invoking phase dispatch
30/11/2006 22:07:53,187 DEBUG asyncDelivery2
HandlerPipeline.invoke - Invoking handler
org.codehaus.xfire.handler.LocateBindingHandler in phase
dispatch
30/11/2006 22:07:53,187 INFO asyncDelivery2
DefaultFaultHandler.invoke - Fault occurred!
org.codehaus.xfire.fault.XFireFault: Could not find a
service to invoke.
at
org.codehaus.xfire.handler.LocateBindingHandler.invoke(LocateBindingHand
ler.java:39)
On 30/11/06, Ruth, Brice D < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
Wow, I had no idea you could use the XFire
client for JMS. That's pretty cool (if it works).
Um ... the problem here seems to be that you're
not setting the ReplyTo. That may be what MQ is balking on as well.
Hmmm.
It looks like JMSChannel.java in XFire sets the
JMSReplyTo from a javax.jms.Destination (say, a Queue) that is stored in
the MessageContext under the key "REPLY_TO". Look here:
http://svn.xfire.codehaus.org/browse/xfire/trunk/xfire/xfire-jms/src/mai
n/org/codehaus/xfire/transport/jms/JMSChannel.java?r=trunk
At approx. lines 194,205.
It looks like the XFire client
(org.codehaus.xfire.client.Client) extends
org.codehaus.xfire.AbstractContext, so just calling:
getClient().setProperty("REPLY_TO",
<destination>)
might work. I don't have a working MQ setup at
the moment, otherwise I'd try.
Cheers,
Brice
-----Original Message-----
From: Wayne Keenan
[mailto:[EMAIL PROTECTED]
Sent: Thursday, November 30, 2006 2:39 PM
To: [email protected]
Subject: Re: [xfire-user] Set JMSChannel replyTo
Thanks for the response. I think I need to set
ws addressing on the dynamic client, but Im a unsure how.
I am registering the JMS transport before
creating the dynamic client, below are the logs. perhaps what im trying
is completely wrong w/ dynamic client as im
getting a MQ error:
Caused by: javax.jms.JMSException: MQJMS1013:
operation invalid whilst session is using asynchronous delivery
my test client is:
import java.lang.reflect.Proxy;
import java.net.MalformedURLException;
import java.net.URL;
import javax.jms.QueueConnectionFactory;
import org.codehaus.xfire.DefaultXFire;
import org.codehaus.xfire.XFire ;
import org.codehaus.xfire.client.Client;
import org.codehaus.xfire.client.XFireProxy;
import
org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import
org.codehaus.xfire.service.binding.ObjectServiceFactory ;
import org.codehaus.xfire.test.Echo;
import
org.codehaus.xfire.transport.jms.JMSTransport;
import com.ibm.mq.jms.JMSC;
import com.ibm.mq.jms.MQQueueConnectionFactory;
public class JMSWSEchoTest {
private XFire xfire;
private QueueConnectionFactory factory;
private JMSTransport transport;
public void setUp()
throws Exception
{
factory = new
MQQueueConnectionFactory();
((MQQueueConnectionFactory)factory).setTransportType(JMSC.MQJMS_TP_BINDI
NGS_MQ);
((MQQueueConnectionFactory)factory).setHostName("localhost");
((MQQueueConnectionFactory)factory).setQueueManager("QM_server");
((MQQueueConnectionFactory)factory).setPort(1414);
xfire = new DefaultXFire();
transport = (JMSTransport) new
JMSTransport(xfire, factory);
xfire.getTransportManager
().register(transport);
}
public void testClient1() throws Exception {
// Create a ServiceFactory to create the
ServiceModel.
// We need to add the JMSTransport to
the list of bindings to create.
ObjectServiceFactory sf = new
ObjectServiceFactory(xfire.getTransportManager());
sf.addSoap11Transport(JMSTransport.BINDING_ID);
// Create the service model
Service serviceModel =
sf.create(Echo.class);
// Create a proxy for the service
XFireProxyFactory factory = new
XFireProxyFactory(xfire);
Echo echo = (Echo)
factory.create(serviceModel, "jms://ARSYSTEM_OUTBOUND");
// Since JMS doesn't really have a
concept of anonymous endpoints, we
// need
// need to let xfire know what JMS
endpoint we should use
((XFireProxy) Proxy.getInvocationHandler
(echo)).getClient().setEndpointUri("jms://ARSYSTEM_INBOUND");
// run the client!
String resString = echo.echo("hello");
//assertEquals("hello", resString);
System.out.println("response:" +
resString);
}
public void testClient2() throws
MalformedURLException, Exception
{
Client client = new Client(new URL("
http://localhost:8191/Echo?wsdl <http://localhost:8191/Echo?wsdl> "));
Object[] response =
client.invoke("echo", new Object[] {"hello"});
System.out.println((String)
response[0]);
}
public static void main(String args[])
throws Exception
{
try
{
JMSWSEchoTest jwt = new
JMSWSEchoTest();
jwt.setUp();
jwt.testClient1();
}
catch (/*MalformedURL*/Exception e)
{
e.printStackTrace();
}
}
}
0 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
0 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
15 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
15 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
15 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
1422 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
1422 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
1422 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
1422 [main] DEBUG
org.codehaus.xfire.transport.DefaultTransportManager - Registered
transport [EMAIL PROTECTED]
2734 [main] DEBUG
org.codehaus.xfire.client.XFireProxy - Method [echo] [hello]
2734 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSTransport - Creating new channel
for uri: jms://ARSYSTEM_INBOUND
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - adding handler
[EMAIL PROTECTED] to phase send
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - adding handler
[EMAIL PROTECTED] to phase
transport
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - adding handler
[EMAIL PROTECTED] to phase
post-invoke
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase post-invoke
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking handler
org.codehaus.xfire.soap.handler.SoapSerializerHandler in phase
post-invoke
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase policy
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase user
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase transport
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking handler
org.codehaus.xfire.soap.handler.SoapActionOutHandler in phase transport
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking phase send
3875 [main] DEBUG
org.codehaus.xfire.handler.HandlerPipeline - Invoking handler
org.codehaus.xfire.handler.OutMessageSender in phase send
4172 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel -
ResponseURI:jms://ARSYSTEM_OUTBOUND
4172 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel - msgtxt:<soap:Envelope
xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema> "
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "><soap:Body><echo
xmlns="http://test.xfire.codehaus.org"><in0>hello</in0></echo></soap:Bod
y></soap:Envelope>
4172 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel -
corrid:11649131364370-593738066
4172 [main] DEBUG
org.codehaus.xfire.transport.jms.JMSChannel -
msgctx.getProp(REPLY_TO):null
org.codehaus.xfire.XFireRuntimeException : Could
not invoke service.. Nested exception is
org.codehaus.xfire.fault.XFireFault: Error sending message
org.codehaus.xfire.fault.XFireFault: Error
sending message
at
org.codehaus.xfire.transport.jms.JMSChannel.send (JMSChannel.java:246)
at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
:26)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)
at
org.codehaus.xfire.client.Invocation.invoke (Invocation.java:75)
at
org.codehaus.xfire.client.Client.invoke(Client.java:335)
at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at
org.codehaus.xfire.client.XFireProxy.invoke (XFireProxy.java:57)
at $Proxy0.echo(Unknown Source)
at
com.turingsmi.messagelogic.net.tests.JMSWSEchoTest.testClient1(JMSWSEcho
Test.java:66)
at
com.turingsmi.messagelogic.net.tests.JMSWSEchoTest.main
(JMSWSEchoTest.java:85)
Caused by: javax.jms.JMSException: MQJMS1013:
operation invalid whilst session is using asynchronous delivery
at
com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment
.java :567)
at
com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1193)
at
com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:3123)
at
org.codehaus.xfire.transport.jms.JMSChannel.send(JMSChannel.java :238)
... 9 more
On 30/11/06, Ruth, Brice D <[EMAIL PROTECTED]>
wrote:
I'm not sure what you mean w/ dynamic
client ... I don't think the dynamic client understands JMS, does it?
Maybe it does and I've missed something. When we've setup JMS with XFire
in an MQ Series environment, the MQ client application set the ReplyTo
in the API calls to the MQ jars - so its specified in the JMS message.
XFire just picks it up from there and does the right thing. You don't
need to specify the reply-to on the server side, if memory serves.
Cheers,
Brice
-----Original Message-----
From: Wayne Keenan
[mailto:[EMAIL PROTECTED]
Sent: Thursday, November 30, 2006 12:15
PM
To: [email protected]
Subject: [xfire-user] Set JMSChannel
replyTo
Hi,
Please can someone advise me on how I
set the JMS ReplyTo property on the serverside service.xml and also for
a 'DynamicClient'?
Thanks
Wayne