At the end of June IBM released the IBM WebSphere MQ Bridge for HTTP support pack. What it basically does is to bring an HTTP API, in a RESTful way, to WebSphere MQ.
MA0Y requires:
- An application server supporting J2EE Connector Architecture, version 1.5.
- WebSphere MQ J2EE Connector Architecture (JCA) resource adapter deployed and operational (included in IBM WebSphere MQ version 6.0.2.1)
An WebSphere MQ resource adapter support statement can be found here.
The MA0Y support pack includes two downloads:
- Install
- includes the WMQHTTP web application archive
- Samples
- A pre-packaged IBM WebSphere Application Server Community Edition with WMQHTTP web application and WebSphere MQ J2EEConnectorArchitecture (JCA) resource adapter
- A client samle application called P2PConsole.
- Deployment plans for IBM Webphere Application Server Community Edition (applicable to Geronimo as well)
Get going with the samles download
- Download and extract from the support pack site
- Verify that you have a local queue manager set up named HTTP.QM
- Navigate to the ma0y.samples\WASCE\bin directory and execute startup.bat
- Navigate to the ma0y.samples\P2PConsole directory
- Run this command java -cp . HTTPPOST SYSTEM.DEFAULT.LOCAL.QUEUE localhost:8080 mq to put a message onto the SYSTEM.DEFAULT.LOCAL.QUEUE on queue manager HTTP.QM.
- Run this command to get (an WMQ get, not HTTP get) messages of the queue java -cp . HTTPDELETE SYSTEM.DEFAULT.LOCAL.QUEUE localhost:8080 mq.
Get going with a clean Geronimo and curl
- Verify that the queue manager HTTP.QM is started on your system.
- Download Geronimo 1.1.1 from here, extract the archive.
- Start Geronimo
- Open a command window in GERONIMO_HOME\bin
- Issue this command: SET JAVA_HOME=PATH_TO_IBM_JAVA. Substitute PATH_TO_IBM_JAVA with a path to an existing IBM Java 1.5 runtime (one is included in the samples package explained above). Using a Sun Java runtime will fail, see the Using JCA article at the IBM site.
- Execute startup.bat
- Geronimo is now started.
- Deploy the WebSphere MQ J2EEConnectorArchitecture (JCA) resource adapter
- Open the Geronimo Console by pointing your favourite browser to http://localhost:8080/console, log in using system/manager.
- Open Console Navigation > Applications > Deploy New
- Archive: WMQ_HOME\Java\lib\jca\wmq.jmsra.rar
- Plan: ma0y.samples\deployedFiles\WASCEPlans\geronimo-ra.xml
- Click Install
- Deploy the WMQHTTP web application archive
- Open the Geronimo Console by pointing your favourite browser to http://localhost:8080/console, log in using system/manager.
- Open Console Navigation > Applications > Deploy New
- Archive: ma0y.samples\deployedFiles\WMQHTTP.war
- Plan: ma0y.samples\deployedFiles\WASCEPlans\geronimo-web.xml (if you use the geronimo jetty bundle replace tomcat with jetty within the file)
- Click Install
- Start testing
- Download curl from the curl site, I used this version: curl-7.16.4-win32-ssl-sspi.zip. Extract and navigate to the directory.
- To PUT a message on a queue
- curl –data “Hello World” –header “Content-Type: text/plain” –verbose http://localhost:8080/mq/msg/queue/SYSTEM.DEFAULT.LOCAL.QUEUE
- To BROWSE the first message in the queue
- curl –get –verbose http://localhost:8080/mq/msg/queue/SYSTEM.DEFAULT.LOCAL.QUEUE
- To GET a message off a queue
- curl –request DELETE –verbose http://localhost:8080/mq/msg/queue/SYSTEM.DEFAULT.LOCAL.QUEUE
Colclusion
- Works like a charm (except for the IBM Java runtime dependency)
- Not yet supported (Category 2 support pack), but most likely will be in the near future.
- Heavy-weigh, needs an application server and resource adapter.
Filed under: ibm, MA0Y, mq, support pack, wmq
[...] has already been reported in several blogs, IBM has released a new supportpac for exposing WebSphere MQ queues and topics as HTTP [...]
Hi,
I was able to run the WAS CE edition (part of sample.zip). However wasnt able to change the default from HTTP.QM.
Tried the same with clean Geronimo & even with the steps mentioned I got the following error
C:\Program Files\IBM\WebSphere MQ HTTP\P2PConsole>java -classpath . HTTPPOST HTT
P.TESTQUEUE
HTTP POST Sample start
Target server is ‘localhost:8080′
Target queue is ‘HTTP.TESTQUEUE’
Target context-root is ‘mq’
ttt
There has been an error trying to POST a message to ‘http://localhost:8080/mq/ms
g/queue/HTTP.TESTQUEUE’. HTTP error response follows…
Apache Tomcat/5.5.15 – Error report HTTP Status 404 – /mq/msg/queue/H
TTP.TESTQUEUEtype Status reportmessage /mq/msg/queue/HTTP.TESTQUEUEdescription
The requested resource (/mq/msg/queue/HTTP.TESTQUEUE) is not available.Apache Tomcat/5.5.15
HTTP POST Sample end
Can you help me figure this out.
Thanks
Just when I posted the problem, I realised that we need to redeploy the web app.
Now it is working fine. Thanks for the steps to use a clean Geronimo steps. You have saved me a lot of effort
Glad to see that the clean Geronimo process helped you out. It’s my intention to get back to the subject with a deeper ananlysis further on.
How could we change default qmanager from HTTP.QM to a different one?