ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Invoking CICS Web Services over MQ

Post new topic  Reply to topic
 Invoking CICS Web Services over MQ « View previous topic :: View next topic » 
Author Message
nabeenj
PostPosted: Wed May 25, 2016 8:47 am    Post subject: Invoking CICS Web Services over MQ Reply with quote

Newbie

Joined: 09 Dec 2015
Posts: 3

Hello experts,

I have a CICS Web Services service and a Java client created in Eclipse using the Web Services > Generate Client tool.

I have WebSphere MQ Server 8.0 installed on my Windows machine.

The client can invoke the web service through HTTP, and I have also been successful in running the client locally to invoke the web service with a uri "jms:/queue?destination=myQ@QMGR&initialContextFactory=com.ibm.mq.jms.Nojndi&connectionFactory=(connectQueueManager(QMGR)binding(auto))&replyDestination=myReplyQ&targetService=/myService" to go through MQ.

However, when trying to run the client on another machine with MQ Client 8.0 installed, I get this error message:
Exception: Cannot get connection using Client/Server bindings. MQCC_FAILED(2) MQRC_CONNECTION_ERROR(2273)

I have created the SVRCONN and CLNTCONN channels and the listener on the MQ Server machine, copied across the AMQCLCHL.TAB to the client machine and set the MQCHLLIB and MQCHTAB environment variables.

I noted that I also get this error on my own MQ Server machine if I change the binding value in the jms:/ uri to "binding(client)".

Can you tell me where I am going wrong please?

Much appreciated.
Back to top
View user's profile Send private message
vennela
PostPosted: Thu May 26, 2016 9:31 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Excellent explanation for your question in this post


http://www.mqseries.net/phpBB2/viewtopic.php?t=68608&highlight=jms+client+uri
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nabeenj
PostPosted: Thu Jun 09, 2016 7:23 am    Post subject: Reply with quote

Newbie

Joined: 09 Dec 2015
Posts: 3

Thank you for pointing me to that post, vennela. Indeed, good questions and excellent answers and explanations - very helpful for someone like me with little experience of JMS. It prompted me to read further the IBM WebSphere MQ docs on "Developing JMS and Java Platform, Enterprise Edition applications". Following the steps there I was able to run the point-to-point installation verification test on the MQ Client machine successfully. I also created my own test Java program using the IBM MQ JMS extensions. It does not use JNDI, but explicity sets the properties of my object instance of the MQConnectionFactory class, as such:

Code:

      try {
         factory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
         factory.setQueueManager(qManager);
         factory.setHostName(hostname);
         factory.setPort(1416);
         factory.setChannel("SYSTEM.DEF.SVRCONN");
         ..


I create objects of MQQueue, Connection, Session, MessageProducer, MessageConsumer and TextMessage. I am able to run this test program on the MQ Client machine to connect to a Queue Manager on the MQ Server machine, put a message and get that message from a queue. It runs through fine...

Now, back to the Java Web Service client that uses a "jms:/queue?destination=.." uri to invoke a web service through MQ Transport, I changed the uri to specify "binding(client)" and to include the connectionFactory parameters clientChannel and clientConnection -

Code:

              endpoint = "jms:/queue?destination=myRequestQ@QMGR"
               + "&initialContextFactory=com.ibm.mq.jms.Nojndi&connectionFactory=(connectQueueManager(QMGR"
               + ")binding(client)clientChannel(SYSTEM.DEF.SVRCONN)clientConnection(nwb-nabeenj8(1416)))&replyDestination=myReplyQ&targetService=/demows";


I am not using JNDI to retrieve the connection and queue information. This is all explicitly specified in the jms uri.

I continued to get the MQRC_CONNECTION_ERROR(2273) exception, this time with a little more information -

Exception: Cannot get connection using Client bindings. MQCC_FAILED(2) MQRC_CONN
ECTION_ERROR(2273).; nested exception is:
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2538'.


After much thought and deliberation I enabled log4j logging for axis, and discovered that the clientConnection value gets messed up. The default port number 1414 gets appended to the parameter value -

(2) (2211); nested exception is:
Cannot get connection using Client bindings. MQCC_FAILED(2) MQRC_CONNECTION_ERROR(2273).; nested exception is:
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2538'.
at com.ibm.mq.soap.transport.jms.WMQSOAPException.getSOAPException(Unknown Source)
at com.ibm.mq.soap.transport.jms.WMQSender.invoke(Unknown Source)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.demows.www.Demows_BindingStub.demoWS(Demows_BindingStub.java:178)
at com.demows.www.DemowsProxy.demoWS(DemowsProxy.java:50)
at soap.client.DemoWSStaticClient.main(DemoWSStaticClient.java:41)
Caused by: Cannot get connection using Client bindings. MQCC_FAILED(2) MQRC_CONNECTION_ERROR(2273).; nested exception is:
com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2538'.
at com.ibm.mq.soap.transport.jms.WMQSOAPException.getSOAPException(Unknown Source)
at com.ibm.mq.soap.transport.jms.WMQAddress.connectToQmgr(Unknown Source)
... 13 more
Caused by: com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2538'.
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:251)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:450)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:487)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:96)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:194)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:767)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:715)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:678)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:148)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:752)
... 14 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host 'nwb-nabeenj8(1416(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9205: The host name supplied is not valid. [3=nwb-nabeenj8(1416,4=TCP]],3=nwb-nabeenj8(1416(1414),5=RemoteTCPConnection.parseConnectionName]
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2299)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1287)
at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:376)
at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:560)
at com.ibm.mq.MQSESSION.MQCONNX_j(MQSESSION.java:916)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:237)
... 23 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9205: The host name supplied is not valid. [3=nwb-nabeenj8(1416,4=TCP]
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.parseConnectionName(RemoteTCPConnection.java:324)
at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1207)
at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:847)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)
at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)
at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1734)
... 28 more


------------------------------------------------

I started the SYSTEM.DEFAULT.LISTENER.TCP Listener for the Queue Manager on the MQ Server machine (after making sure no other TCP Listeners of other QMs had been started on the same port), and changed the clientConnection parameter to just the host name - "clientConnection(nwb-nabeenj8)".

After this, SUCCESS!
I was able to invoke the web service through MQ and got back the desired response.

So, I guess the one question remains - how would I specify the port in the clientConnection parameter (or another parameter in the uri?) so that I can use other than the default 1414?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jun 09, 2016 4:54 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Have you tried the variant
Code:
&hostname=blabla&port=1639
in your connection setup? Otherwise go for the file based JNDI. Looks like you could use it
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
nabeenj
PostPosted: Fri Jun 10, 2016 9:17 am    Post subject: Reply with quote

Newbie

Joined: 09 Dec 2015
Posts: 3

Thank you for this suggestion fjb_saper. I tried adding in the hostname and port parameters into the uri, but it didn't work. With any sort of variant - I get exceptions "Invalid value jms:/queue?destination=.." or "Could not parse URL jms:/queue?destination=.."

Looks like I will have to stick with going to the default 1414 port.

I don't think file based JNDI is an option for web service requests through MQ. Just going according to the IBM MQ docs to create my Java JAX-RPC web service clients. Under Reference > Developing applications reference > SOAP reference > URI parameters, it says this about the initialContextFactory URI parameter -

Quote:

&initialContextFactory = contextFactory
contextFactory is required and must be set to com.ibm.mq.jms.Nojndi. Make sure Nojndi.jar is in the class path for a WebSphere Application Server Web services client. Nojndi.jar returns Java objects based on the contents of the connectionFactory and destination parameters, rather than by reference to a directory.


Thank you for your suggestion though, and the explanations in the other post pointed out by vennela.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Invoking CICS Web Services over MQ
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.