пятница, 25 июля 2014 г.

Standalone Spring 3 JMS client to WebSphere MQ 7.0

There are a lot of blogs about creating JMS clients, but I couldn't find one simple article about connecting to WebSphere MQ 7.0 from java client.

Let's start:

1)  download the following jars from WebSphere MQ 7 installation into your project classpath:
12.08.2010  17:06            13 143 CL3Export.jar
12.08.2010  17:06            33 166 CL3Nonexport.jar
12.08.2010  17:09           356 856 com.ibm.mq.headers.jar
12.08.2010  17:09           440 087 com.ibm.mq.jar
12.08.2010  17:09         1 932 269 com.ibm.mq.jmqi.jar
12.08.2010  17:09           104 492 com.ibm.mq.pcf.jar
12.08.2010  17:09         3 266 359 com.ibm.mqjms.jar
12.08.2010  17:07            17 978 connector.jar
12.08.2010  17:06         2 011 813 dhbcore.jar
12.08.2010  17:08            22 769 fscontext.jar
12.08.2010  17:08            77 116 providerutil.jar
12.08.2010  17:06           893 748 rmm.jar

2) in your application context configure the client:

<!-- WebSphere MQ Connection Factory -->
    <bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
        <property name="hostName">
            <value>host</value>
        </property>
        <property name="port">
            <value>port</value>
        </property>
        <property name="queueManager">
            <value>value</value>
        </property>
        <property name="transportType">
            <value>1</value>
        </property>
    </bean>

    <bean id="jmsQueueConnectionFactory"
        class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory">
            <ref bean="mqConnectionFactory" />
        </property>
    </bean>
   
    <bean id="jmsContainer"
        class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="jmsQueueConnectionFactory" />
        <property name="destinationName" value="queue_name" />
        <property name="messageListener" ref="inMessageListener" />
    </bean>

<bean id="inMessageListener" class="ru.mq.MyMessageListener" />

Now, you can receive JMS messages in a standalone application from WebSphere MQ.

вторник, 15 июля 2014 г.

Deploy EJB 3 web service to Websphere Application Server 8.5.5

One of the EJB 3.x features is that you can expose stateless EJB as web service.
If you use Rational Application Developer you  can use the following procedure to expose EJB as web service:

  1. Annotate your EJB bean with the @WebService annotation, and any other annotations required for your implementation.
  2. Create JMS or HTTP router modules for the web service as described in: Creating web service router modules. New in WebSphere Application Server v8, if you package your EJB application in a WAR module, you do not need to create router modules.
  3. Publish the application to a server.
Well, I had EJB in web module, which was packaged in EAR. Surprisingly for me EJB started but web service was not exposed, but the conditions were fulfilled. Then I deploy just WAR file and web service becomes available.


Moral: learn and practice as much as you can and double check what is written in documentation. 

вторник, 8 июля 2014 г.

Book I have read recently

is the book I have read recently. It is a good introduction to XML and related technologies. It is not a reference book, but a textbook or tutorial. 
It tells you about XML, namespaces, XML Schema, XPath, XSLT and among interesting things - WSDL and SOAP. This book is a good start to learn XML.

Among XML editors I recommend to use Altova XML Spy. You can download trial version. 
In java you can use IBM java api for XML which provides support for XML standards XSLT 2.0, XPath 2.0, and XQuery 1.0. Link to the book.