Showing posts with label setup. Show all posts
Showing posts with label setup. Show all posts

Wednesday, April 22, 2015

Setup WSO2 ESB server and ActiveMQ server (Part 3) - WSO2 ESB and ActiveMQ connection


I've installed WSO2 and ActiveMQ in the past two blogs.
Setup WSO2 ESB server and ActiveMQ server (Part 1) - Installation
Setup WSO2 ESB server and ActiveMQ server (Part 2)

The WSO2 ESB server - Console URL is https://localhost:9443/carbon/admin/login.jsp
ActiveMQ server - Console URL is http://localhost:8161/admin/queues.jsp

The next we will verify the connection of WSO2 and ActiveMQ.
1. Create a new JMS proxy service. (The same way as in part 2)


2. Replace the source with the following xml doc.

 <?xml version="1.0" encoding="UTF-8"?>  
 <proxy xmlns="http://ws.apache.org/ns/synapse"  
     name="echoJmsProxy"  
     transports="https,http"  
     statistics="disable"  
     trace="disable"  
     startOnLoad="true">  
   <target>  
    <endpoint>  
      <address uri="jms:/EchoQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;  
      java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;  
      java.naming.provider.url=tcp://localhost:61616"/>  
    </endpoint>  
   </target>  
   <publishWSDL uri="http://localhost:9763/services/echo?wsdl"/>  
   <parameter name="OUT_ONLY">true</parameter>  
   <parameter name="FORCE_SC_ACCEPTED">true</parameter>  
   <description/>  
 </proxy>  

 



3. Click Try this service.
Modify the attribute and click send.


4. Now login to ActiveMQ. We can see there is a message in the queue.


It verified the WSO2 ESB and ActiveMQ connected successfully.




Setup WSO2 ESB server and ActiveMQ server (Part 2)

We will create a simple proxy service to verify WSO2 ESB working fine.

From the part 1, the WSO2 ESB server has been installed in local machine, and we can get into it  through the URL:
The WSO2 ESB server - Console URL is  https://localhost:9443/carbon/admin/login.jsp

There is an echo service built in the wso2 ESB server. We will just add a simple proxy service to make sure it goes through.

    1) Go to WSO2 ESB console. Click on the left side Services - Add - Proxy Service.
On the middle of the window, choose Pass Through Proxy.



   2) Now you get into the page. Enter Proxy service name, and Target URL, then click Create button.



   3) Now you can see the service is in the deployed services list.
       Click source view link.


  4) In the source view window, we will use the follow xml document replace the default one. Then save it.

 <?xml version="1.0" encoding="UTF-8"?>  
 <proxy xmlns="http://ws.apache.org/ns/synapse"  
     name="echoProxy"  
     transports="https,http"  
     statistics="disable"  
     trace="disable"  
     startOnLoad="true">  
   <target>  
    <outSequence>  
      <send/>  
    </outSequence>  
    <endpoint>  
      <address uri="http://localhost:9763/services/echo"/>  
    </endpoint>  
   </target>  
   <publishWSDL uri="http://localhost:9763/services/echo?wsdl"/>  
   <description/>  
 </proxy>  


   5) Now click Try this service 


6) In the try echoProxy service window, we can change the attribute in the request window, then click send, in the response window, we can see the result.



If we get the return number as above, that means the simple proxy service is working in the wso2 esb server.



Thursday, April 16, 2015

Setup WSO2 ESB server and ActiveMQ server (Part 1) - Installation

I have a new project which need to post an xml with a data range to a third party url, then get an xml response back, at last to process the response xml message and save it into database.
I've done this kind of job by using pure java code or Talend ETL open studio.

This time I am trying to using WSO2 ESB server and ActiveMQ server to finish the job.

1. Install ESB and ActiveMQ
 I need to install WSO2 ESB server and ActiveMQ server in my local machine,
These are the version I installed in my local.


2. ESB/ActiveMQ configuration


1) Copy relevant JMS client libraries to WSO2 ESB.
For Apache ActiveMQ, copy
[ActiveMQ_HOME]/lib/
activemq-broker-5.8.0
activemq-client-5.8.0,
geronimo-j2ee-management_1.1_spec-1.0.1.jar and
geronimo-jms_1.1_spec-1.1.1.jar
hawtbuf-1.9

to
[WSO2 ESB HOME]/repository/components/lib

2)  To enable JMS queues, define JNDI in [WSO2 ESB Home]\repository\conf\jndi.properties
connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/test?brokerlist='tcp://localhost:61616'

3) Enable JMS Receiver
Edit  Axis2 configuration file ([ESB Home] \repository\conf\axis2\axis2.xml
Uncomment <transportReceiver> section under “<!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ) -->”

4) Enable JMS Sender
  <!-- uncomment this and configure to use connection pools for sending messages> -->
  <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>



3. Start server to verify

Go to [wso2esbhome]\bin directory
run wso2server.bat

Go to [activemq home]\bin 
run activemq.bat

Then I can go to console to verify if the servers are on.

The WSO2 ESB server - Console URL is https://localhost:9443/carbon/admin/login.jsp
ActiveMQ server - Console URL is http://localhost:8161/admin/queues.jsp

The user name and password for both servers are admin/admin.

If everything is correct, we can land on the following web console page.