Tuesday, June 6, 2017

Configuring timeout intervals in WSO2 ESB.

WSO2 ESB has several timeout settings and you have to consider following order when setting timeouts:

Socket Timeout > max (Global endpoint timeout, Timeout of individual endpoints)

endpoint timeout :

You could define timeouts on the endpoint configuration such that it will affect only that particular endpoint. This will be a better option if you need to configure timeouts per endpoint for different Back End services. You can also define the action upon the timeout. Below example configuration will set the endpoint to timeout in 120 seconds and then execute the fault handler.

<timeout>

    <duration>120000</duration>

    <responseAction>fault</responseAction>

</timeout>

synapse.global_timeout_interval property could be configured in the following way:

1. The open ESB_HOME /repository/conf/synapse.properties file.

2. Add synapse.global_timeout_interval property if it is not defined already (The default value is 120 seconds).

synapse.global_timeout_interval=120000

3. Save the file and restart the ESB.

Follow below steps to set http.socket.timeout property:

1. Open <esb_home>/repository/conf/passthru-http.properties file.

2. Add http.socket.timeout property if it not defined already.

http.socket.timeout=150000

3. Save the file and restart the ESB.

Monday, May 22, 2017

How to configure scheduled task as a cron style entry in WSO2 ESB.

This article explains, how to add a CRON job to run a scheduled task for once a week. This particular example demonstrates a scheduled task to run on every Tuesday at 10:27 AM.

Please find below the CRON style to run the scheduled task every Tuesday at 10:27 AM:
0 27 10 ? * TUE *

Please find below the Task configuration which uses the above CRON style:

<task name="sampleTask"
         class="org.apache.synapse.startup.tasks.MessageInjector"
         group="synapse.simple.quartz">
      <trigger cron="0 27 10 ? * TUE *"/>
      <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
         <test xmlns="">heloooooooo</test>
      </property>
      <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
                name="proxyName"
                value="testProxy"/>
      <property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
                name="soapAction"
                value="soap11"/>
</task>

We received below logs for above task configuration:

[2017-05-23 10:27:00,004]  INFO - LogMediator To: , WSAction: soap11, SOAPAction: soap11, MessageID: urn:uuid:9689e4b5-5b8c-47bb-9cf8-c953fd5130cc, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><test>heloooooooo</test></soapenv:Body></soapenv:Envelope>


Please refer this link which is a CRON maker, for creating more CRON job expressions.


Wednesday, May 3, 2017

How to overcome the issue "ESB adds port 80 to host header for http endpoints" in WSO2 ESB 4.8.1

There is a known issue in WSO2 ESB 4.8.1 where it adds port 80 to host header for http endpoints.

Issue: Please find the below logs on how ESB 4.8.1 sends the host header for http endpoints.
[2017-04-28 14:54:00,620] DEBUG - wire << "GET /v2/59030280110000c10b975dc7 HTTP/1.1[\r][\n]"
[2017-04-28 14:54:00,620] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-04-28 14:54:00,620] DEBUG - wire << "Host: www.mocky.io:80[\r][\n]"
[2017-04-28 14:54:00,620] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2017-04-28 14:54:00,620] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"

As you could see in the above logs it always adds port 80 at the end of Host Header. As a solution you could add below property with the host header that you want the ESB to send the request.
<property name="REQUEST_HOST_HEADER" value="www.mocky.io" scope="axis2"></property>

Configured the below simple API to test the above property.
<api xmlns="http://ws.apache.org/ns/synapse" name="testAPI" context="/testAPI">
   <resource methods="GET">
      <inSequence>
<property name="REQUEST_HOST_HEADER" value="www.mocky.io" scope="axis2"></property>
         <send>
            <endpoint>
               <http method="get" uri-template="http://www.mocky.io/v2/59030280110000c10b975dc7"></http>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
        <send></send>
      </outSequence>
  </resource>
</api>

We received below logs after adding the REQUEST_HOST_HEADER property in the API.
[2017-04-28 15:13:34,735] DEBUG - wire << "GET /v2/59030280110000c10b975dc7 HTTP/1.1[\r][\n]"
[2017-04-28 15:13:34,736] DEBUG - wire << "Host: www.mocky.io[\r][\n]"
[2017-04-28 15:13:34,736] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-04-28 15:13:34,736] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2017-04-28 15:13:34,736] DEBUG - wire << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"

Tuesday, May 2, 2017

How to Convert a JSON Message to SOAP and SOAP to JSON in a Generic Way WSO2 APIM.

Please note that we have tested this scenario on APIM 2.1.0. In this scenario we are using synapse IN and OUT extensions to transform json to xml and vice versa in a generic way.
  • Use below configuration as the IN extension. 
Please find more information on adding Mediation Extensions in [1]

admin-TestPhoneApi:v1.0.0-IN
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="admin--TestPhoneApi:v1.0.0--IN">
    <log level="custom">
        <property name="TRACE" value="Global Mediation Extension"/>
    </log>
 <enrich>
            <source clone="true" xpath="$body/jsonObject/node()"/>
            <target type="body"/>
         </enrich>
         <enrich>
            <source type="body" clone="true"/>
            <target type="property" property="requestPayload"/>
         </enrich>       
         <payloadFactory media-type="xml">
             <format>
           <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://ws.cdyne.com/PhoneVerify/query">
 <soapenv:Body>
       $1
 </soapenv:Body>
</soapenv:Envelope>
</format>
           <args>
               <arg evaluator="xml" expression="$ctx:requestPayload"/>
            </args>
         </payloadFactory>
</sequence>

  • Use below configuration as the OUT extension.

admin-TestPhoneApi:v1.0.0-OUT

<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="admin--TestPhoneApi:v1.0.0--OUT">
    <log level="custom">
        <property name="TRACE" value="Global Mediation Extension"/>
    </log>
<property name="messageType" value="application/json" scope="axis2"/>
</sequence>

  • Create a simple API to send the message to back-end. In here we used "http://ws.cdyne.com/phoneverify/phoneverify.asmx" as the endpoint.

<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
     name="admin--TestPhoneApi"
     context="/TestPhoneApi/1.0.0"
     version="1.0.0"
     version-type="context">
   <resource methods="POST" url-mapping="/*" faultSequence="fault">
      <inSequence>              
         <log level="full"/>
         <property name="api.ut.backendRequestTime"
                   expression="get-property('SYSTEM_TIME')"/>
         <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
            <then>
               <send>
                  <endpoint name="admin--TestPhoneApi_APIproductionEndpoint_0">
                     <http format="soap12"
                           uri-template="http://ws.cdyne.com/phoneverify/phoneverify.asmx"/>
                     <property name="ENDPOINT_ADDRESS"
                               value="http://ws.cdyne.com/phoneverify/phoneverify.asmx"/>
                 </endpoint>
               </send>
            </then>
            <else>
               <sequence key="_sandbox_key_error_"/>
           </else>
         </filter>
      </inSequence>
      <outSequence>
         <class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
         <send/>
      </outSequence>
   </resource>
   <handlers>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler"/>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
         <property name="apiImplementationType" value="ENDPOINT"/>
      </handler>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler"/>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtUsageHandler"/>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtGoogleAnalyticsTrackingHandler">
         <property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/>
      </handler>
      <handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/>
   </handlers>
</api>

  • Request 1 with headers :
{"CheckPhoneNumber":{"PhoneNumber":"18006785432","LicenseKey":"0"}}
  • Response for request 1:

{
  "CheckPhoneNumberResponse": {
    "CheckPhoneNumberResult": {
      "Company": "Toll Free",
      "Valid": true,
      "Use": "Assigned to a code holder for normal use.",
      "State": "TF",
      "RC": null,
      "OCN": null,
      "OriginalNumber": 18006785432,
      "CleanNumber": 8006785432,
      "SwitchName": null,
      "SwitchType": null,
      "Country": "United States",
      "CLLI": null,
      "PrefixType": "Landline",
      "LATA": null,
      "sms": "Landline",
      "Email": null,
      "AssignDate": null,
      "TelecomCity": null,
      "TelecomCounty": null,
      "TelecomState": "TF",
      "TelecomZip": null,
      "TimeZone": null,
      "Lat": null,
      "Long": null,
      "Wireless": false
    }
  }
}


  • Request 2 with headers:
{"CheckPhoneNumbers":{"PhoneNumbers":{"string":"1"},"LicenseKey":"0"}}
  • Response for request 2
{
  "CheckPhoneNumbersResponse": {
    "CheckPhoneNumbersResult": {
      "PhoneReturn": {
        "Valid": false,
        "OriginalNumber": 1,
        "CleanNumber": null,
        "Wireless": false
      }
    }
  }
}


Monday, April 17, 2017

How to send out the header "JMS_COORELATION_ID" with the message in WSO2 ESB.

In order to send the  "JMS_COORELATION_ID" with the message from wso2 ESB you are required to configure it as a transport header in the synapse configuration.

Hence, the property you need to configure is as below:

 <property name="JMS_COORELATION_ID" value="12345" scope="transport"/>

Please find the proxy configuration below which we tested the above property:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="SMSForwardProxy"
       transports="jms"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="JMS_COORELATION_ID" value="12345" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>contentType</jmsProperty>
         <default>text/xml</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
   <parameter name="transport.jms.DestinationType">queue</parameter>
   <parameter name="transport.jms.Destination">SMSStore</parameter>
   <description/>
</proxy>

With the above configuration we managed to send the "JMS_COORELATION_ID" with the message out from the ESB. Please find the logs below:

[2017-04-13 16:19:29,648] DEBUG - wire << "POST /services/SimpleStockQuoteService HTTP/1.1[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_DESTINATION: SMSStore[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_MESSAGE_ID: ID:45c1d2d1-4c1c-3bb7-b249-9af5f0dcf7bf[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_REPLY_TO: SMSReceiveNotificationStore[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_QPID_DESTTYPE: 1[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_PRIORITY: 4[\r][\n]"
[2017-04-13 16:19:29,648] DEBUG - wire << "JMS_TIMESTAMP: 1492080567188[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "JMS_EXPIRATION: 0[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "JMS_COORELATION_ID: 12345[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "Accept-Encoding: gzip,deflate[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "JMS_REDELIVERED: false[\r][\n]"
[2017-04-13 16:19:29,649] DEBUG - wire << "Content-Type: text/xml; charset=UTF-8[\r][\n]"   

Sunday, April 16, 2017

How to install SCIM feature to WSO2 APIM 2.1.0

By default SCIM feature is not available in APIM. You could enable the SCIM feature using the pom.xml based approach. Please find the steps below to enable SCIM feature in APIM 2.1.0 using pom.xml based approach.

  • Downloaded the p2 repo from [1] (WSO2 Carbon 4.4.x (Wilkes))
  • Download the wso2am-2.1.0.zip from [2].
  • Unzip wso2am-2.1.0.zip and p2-repo.zip into the same directory.
  • Create a pom.xml file including below configuration and copy into the same directory.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelVersion>4.0.0</modelVersion>     <groupId>org.wso2.sample</groupId>     <artifactId>sample-feature-installation</artifactId>     <version>1.0.0</version>     <packaging>pom</packaging>     <name>New feature</name>     <url>http://wso2.org</url>     <build>         <plugins>            <plugin>                 <groupId>org.wso2.maven</groupId>                 <artifactId>carbon-p2-plugin</artifactId>                 <version>1.5.4</version>                 <executions><                     <execution>                         <id>feature-install</id>                         <phase>package</phase>                         <goals>                             <goal>p2-profile-gen</goal>                         </goals>                         <configuration>                             <profile>default</profile>                             <metadataRepository>file:p2-repo</metadataRepository>                             <artifactRepository>file:p2-repo</artifactRepository>                             <destination>wso2am-2.1.0/repository/components</destination>                             <deleteOldProfileFiles>false</deleteOldProfileFiles>                             <features>                                 <feature>                                     <id>org.wso2.carbon.identity.scim.feature.group</id>                                     <version>5.2.0</version>                                 </feature> <feature>                                     <id>org.wso2.carbon.identity.provisioning.server.feature.group</id>                                     <version>5.7.5</version>                                 </feature>                             </features>                         </configuration>                     </execution>                 </executions>             </plugin>             <plugin>                 <groupId>org.apache.maven.plugins</groupId>                 <artifactId>maven-antrun-plugin</artifactId>                 <version>1.1</version>                 <executions>                     <execution>                         <phase>package</phase>                         <configuration>                             <tasks>                                 <replace token="false" value="true" dir="wso2am-2.1.0/repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator">                                     <include name="**/bundles.info"/>                                 </replace>                             </tasks>                         </configuration>                         <goals>                             <goal>run</goal>                         </goals>                     </execution>                 </executions>             </plugin>         </plugins>     </build>     <repositories>         <repository>             <id>wso2-nexus</id>             <name>WSO2 internal Repository</name>             <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>             <releases>                 <enabled>true</enabled>                 <updatePolicy>daily</updatePolicy>                 <checksumPolicy>ignore</checksumPolicy>             </releases>         </repository>     </repositories>     <pluginRepositories>         <pluginRepository>             <id>wso2-maven-releases-repository</id>             <url>http://maven.wso2.org/nexus/content/repositories/releases/</url>         </pluginRepository>         <pluginRepository>             <id>wso2-maven-snapshots-repository</id>             <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>         </pluginRepository>     </pluginRepositories> </project>
  • Run below command:
mvn clean install
  • Enable SCIM for the primary user store from user-mgt.xml file as follows
<Property name="SCIMEnabled">true</Property>
  • Start the server.

Thursday, April 13, 2017

How to read/write files using VFS transport in WSO2 ESB

To enable the VFS transport
Edit the <ESB_HOME>/repository/conf/axis2/axis2.xml file and uncomment the VFS listener and the VFS sender as follows:

<transportreceiver name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportListener"/>
<transportSender name="vfs" class="org.apache.synapse.transport.vfs.VFSTransportSender"/>

Create a folder structure as below:
├── Pass ├── Original ├── Failures ├── output
             ├── test.xml 

Configure the below proxy in WSO2 ESB.

<proxy name="testVFS" startonload="true" trace="disable" transports="https http vfs" xmlns="http://ws.apache.org/ns/synapse">
   <description>
   <target>
      <insequence>
         <property name="transport.vfs.ReplyFileName" scope="transport" value="myfile.xml">
         <property name="OUT_ONLY" value="true">
         <send>
            <endpoint>
               <address uri="vfs:file:///home/ubuntu/output">
            </address>
</endpoint>
         </send>
      </property></property></insequence>
   </target>
   <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
   <parameter name="transport.PollInterval">5</parameter>
   <parameter name="transport.vfs.MoveAfterProcess">file:///home/ubuntu/Pass</parameter>
   <parameter name="transport.vfs.FileURI">file:///home/ubuntu/Original</parameter>
   <parameter name="transport.vfs.MoveAfterFailure">file:///home/ubuntu/Failures/</parameter>
   <parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
   <parameter name="transport.vfs.ContentType">application/xml</parameter>
   <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</description>
</proxy>

Our proxy will automatically poll for files in the given location.

  • test.xml file will be located in file:///home/ubuntu/Pass
  • myfile.xml will get created in the file:///home/ubuntu/output folder

Wednesday, April 12, 2017

Configuring WSO2 ESB 4.8.1 with File Connector Version 2 to read a text file

Please note that File connector Version 2 is not supported with WSO2 ESB 4.8.1. To make the file connector V2 to be supported with ESB 4.8.1 you are required to upgrade the commons-net orbit bundle in ESB 4.8.1.

All you need to do is to get a copy of the commons-net_3.3.0.wso2v1.jar from a ESB 4.9.0 pack which could be found on <ESB_4.9.0_HOME>/repository/components/plugins and apply it to <ESB_4.8.1_HOME>/repository/components/dropins. 

Restart the ESB 4.8.1 server after applying the commons-net_3.3.0.wso2v1.jar.

Please follow below steps in order to read a text file using file connector V2 in ESB 4.8.1. 

Upload the file connector V2 and enable it. 
Create a file and add a text value to it. Here we added below text value to the text file.
 hello Shadsha 
Create a pass-through proxy service in ESB. Please find the proxy configuration below: (As the source path specify the path to the above created text file)
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testProxy"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <fileconnector.read>
            <source>/home/ubuntu/Desktop/file/file1.txt</source>
            <contentType>text/plain</contentType>
            <encoding>utf-16le</encoding>
         </fileconnector.read>
         <log level="full"/>
         <respond/>
      </inSequence>
   </target>
</proxy>

Send a request to the proxy service and you will be able to see the logs as below:
[2017-04-11 16:30:37,677]  INFO - LogMediator To: /services/Proxy1, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:6680285b-32e6-4d23-887f-22b65f5ea002, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload">hello Shadsha</text></soapenv:Body></soapenv:Envelope>

Friday, April 7, 2017

Configuring WSO2 ESB with File Connector Version 2 to read a text file

This blog illustrates on how to use  File Connector Version 2 with WSO2 ESB 4.9.0/5.0.0. In here we are reading a simple text file using file connector.

Download the File Connector Version 2 from here.
Download ESB from here.

In this example, we will be using WSO2 ESB 4.9.0 with file connector version 2.0.7. In order to install the file connector you are required to start the ESB instance using below command: (<ESB_HOME>/bin)
 ./wso2server.sh

To add a connector:

  • On the Main tab in the ESB Management Console, under Connectors click Add.
  • Click Browse, specify the ZIP file, and click Open.
  • Click Upload.
  • The connector will now appear in the Connectors list and is ready to be enabled in your ESB instance.

To enable a connector:

  • On the Main tab in the ESB Management Console, under Connectors click List to view the uploaded connectors.
  • Click Enable next to a connector you want to enable, and then confirm that you want to change its status. 

Create a file and add a text value to it. Here we added below text value to the text file.
 hello Shadsha 
Create a pass-through proxy service in ESB. Please find the proxy configuration below: (As the source path specify the path to the above created text file)
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testProxy"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <fileconnector.read>
            <source>/home/ubuntu/Desktop/file/file1.txt</source>
            <contentType>text/plain</contentType>
            <encoding>utf-16le</encoding>
         </fileconnector.read>
         <log level="full"/>
         <respond/>
      </inSequence>
   </target>
</proxy>

Send a request to the proxy service and you will be able to see the logs as below:
[2017-04-07 14:26:50,898]  INFO - LogMediator To: /services/Proxy1, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:f7270bb4-5935-4bca-828b-c5ad7f8fc9bb, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><text xmlns="http://ws.apache.org/commons/ns/payload">hello Shadsha
</text></soapenv:Body></soapenv:Envelope>

Thursday, April 6, 2017

How to test if the registry is mounted properly in a WSO2 ESB Worker Manager Cluster.

In this article I will elaborate the steps required to test the registry mounting in a WSO2 ESB Worker Manager Cluster.

1. Create a file named abc.txt in the registry ("/_system/governance" path) with the below configuration.

<property name="test" value="Sampletest"/>

2. Add the below proxy service to the manager node.

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testProxy"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="###########symbol#########"
                      expression="get-property('registry','gov:/abc.txt')"/>
         </log>
         <drop/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://www.google.com"/>
      </endpoint>
   </target>
   <description/>
</proxy>


3. Send a single request to a worker and look for a log as below.

[2016-10-05 21:47:04,728]  INFO - LogMediator ###########symbol######### = <property name="test" value="Sampletest"/>

4. Change the registry saved value to "Sampletest123".

5. Send another request to the worker after changing the above resource value and look for a log as below. See whether it has logged the changed property value. If it has changed that means registry mounting works properly.

[2016-10-05 21:48:06,488]  INFO - LogMediator ###########symbol######### = <property name="test" value="Sampletest123"/>

Please refer [1] for clustering WSO2 ESB.

[1] https://docs.wso2.com/display/CLUSTER44x/Clustering+ESB+4.9.0#ClusteringESB4.9.0-Configuringtheloadbalancer

Wednesday, April 5, 2017

How to Install Oracle Java on Ubuntu Linux

As WSO2 products require to have Java installed, this article will guide you through the process of installing Java 7 on Ubuntu environment.

First, add Oracle's PPA, then update your package repository.

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

To install JDK 7, use the following commands:

sudo apt-get install oracle-java7-installer

sudo apt-get install oracle-java7-set-default

Edit the system PATH file /etc/profile and add the following system variables to your system path. Use gedit, nano or any other text editor, as root, open up /etc/profile.

To open in gedit use below command:

sudo gedit /etc/profile

Scroll down to the end of the file using your arrow keys and add the following lines below to the end of your /etc/profile file:

If you are installing the JDK use below configuration (note: you are required to change the $JAVA_HOME as per the jdk location on your computer):

JAVA_HOME=/usr/local/java/jdk1.7.0_45
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH

Or if you are installing the JRE use below:

JRE_HOME=/usr/local/java/jre1.7.0_45
PATH=$PATH:$JRE_HOME/bin
export JRE_HOME
export PATH

Save the /etc/profile file and exit.

Tuesday, April 4, 2017

How to enable Hazelcast Debug logs in WSO2 ESB 4.9.0

In order to enable Hazelcast Debug logs browse to <ESB_HOME>/repository/conf/etc/logging-bridge.properties file.

Configure the below in logging-bridge.properties file.

com.hazelcast.level = DEBUG

In order to get the effects restart is required and you could see similar logs as below which are related to Hazelcast:

[2017-02-17 11:07:49,325]  INFO - ClusterGroupCommunicator Task [ESB_TASK] member departed [Member [172.22.217.136]:4200], rescheduling missing tasks...
[2017-02-17 11:07:49,699]  WARN - BasicMapContextQuerySupport [172.22.217.136]:4300 [wso2.esb.domain] [3.5.3] Could not get results
java.util.concurrent.ExecutionException: com.hazelcast.spi.exception.TargetNotMemberException: Not Member! target:Address[172.22.217.136]:4200, partitionId: -1, operation: com.hazelcast.map.impl.operation.QueryOperation, service: hz:impl:mapService

Monday, April 3, 2017

How to cluster ActiveMq with WSO2 ESB

This tutorial will illustrate how to configure Activemq(5.8.0) cluster with WSO2 ESB 5.0.0.

Download ActiveMQ


Download WSO2 ESB 5.0.0


Clustering ActiveMQ

There is no special configuration required for ActiveMQ clustering you only need to extract two ActiveMQ instances and host them in two different IP host or change the port if the ActiveMQ instances are in same IP host.

Start ActiveMQ

cd [activemq_install_directory]
bin/activemq start


Copy Jars to WSO2 ESB

If you are using ActiveMQ version 5.8.0 or later, copy following jars  to <ESB_HOME>/repository/components/lib directory.

  • activemq-broker-5.8.0.jar
  • activemq-client-5.8.0.jar
  • activemq-kahadb-store-5.8.0.jar 
  • geronimo-jms_1.1_spec-1.1.1.jar
  • geronimo-j2ee-management_1.1_spec-1.0.1.jar
  • geronimo-jta_1.0.1B_spec-1.0.1.jar
  • hawtbuf-1.9.jar
  • Slf4j-api-1.6.6.jar
  • activeio-core-3.1.4.jar (available in <AMQ_HOME>/lib/optional folder)

Enable JMS receiver for ESB

To enable the JMS transport listener, configure the following listener configuration related to ActiveMQ in <ESB_HOME>/repository/conf/axis2/axis2.xml file. Please note that we have configured the provider url as failover scenario here.

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
       <parameter name="myTopicConnectionFactory" locked="false">
           <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
           <parameter name="java.naming.provider.url" locked="false">failover:(tcp://xx.xx.xx:61616,tcp://xx.xx.xy:61616)</parameter>
           <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
       </parameter>
  
       <parameter name="myQueueConnectionFactory" locked="false">
           <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
           <parameter name="java.naming.provider.url" locked="false">failover:(tcp://xx.xx.xx:61616,tcp://xx.xx.xy:61616)</parameter>
           <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
       </parameter>
  
       <parameter name="default" locked="false">
           <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
           <parameter name="java.naming.provider.url" locked="false">failover:(tcp://xx.xx.xx:61616,tcp://xx.xx.xy:61616)</parameter>
           <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
            <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
       </parameter>
</transportReceiver>


Enable JMS sender for ESB

To enable the JMS transport sender, un-comment the following configuration in <ESB_HOME>/repository/conf/axis2/axis2.xml file.

<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>



For more information on activemq clustering refer [1].


[1] http://activemq.apache.org/clustering.html

Wednesday, March 22, 2017

How to split large log files into smaller files in Linux.

If for instance you were wanting to break a large wso2carbon.log file down so that it can be read for analyzing, you could use the split command with the -bytes flag.

Command:

split [option] [input] [output]


For example you wish to break a 5GB file into files of 1G size (wso2carbon.log.2017-03-18) use below command.

split -b 1G -d wso2carbon.log.2017-03-18 carbonlog-part


Your split potions will be as below:

Tuesday, March 21, 2017

How to search messages in WSO2 ESB Analytics Server using Lucene Query Syntax.

Please refer documentation [1] to configure WSO2 ESB with WSO2 ESB Analytics for monitoring.

Use-case: Lets assume you have list of messages published to ESB as below and you are required to search a specific message in ESB Analytics.



Before searching for a specific criteria we could look into the corresponding table to identify the key words to search. Please find the table below for reference.


1. Searching based on the message ID 

Lucene syntax for messageid 

messageFlowId:"urn_uuid_3586f01a-62ab-45fd-b017-90703088e8bc431453695069265"


2. Searching based on the payload

Lucene syntax for afterpayload

afterPayload:"AAA"


3. Searching based on the Status.

Lucene syntax for status "success"

faultCount: "0"


Lucene syntax for status "failed"

faultCount: "1 "

For more information on using Query Language Reference please refer [2]

[1] https://docs.wso2.com/display/ESB50/Monitoring+WSO2+ESB+with+WSO2+ESB+Analytics
[2] https://docs.wso2.com/display/DAS300/Query+Language+Reference

Tuesday, February 21, 2017

How to insert vault key and password using admin services in ESB


Follow below steps to insert vault key and password.

  • To enable the AdminServices in esb set the HideAdminServiceWSDLs property to false in carbon.xml located in <ESB_HOME/repository/conf/carbon.xml.

<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>

  • Restart the server to take effect of the configuration changes.

  • Create SOAPUI project using the below WSDLs (make sure to change the host name port as per your environment. Here default environment settings are used)

https://localhost:9443/services/PropertiesAdminService?wsdl

https://localhost:9443/services/MediationSecurityAdminService?wsdl

  • The SOAP projects will look like below.

  • First invoke the MediationSecurityAdminService AdminService to get the encrypted value. Please use basic authentication when invoking the AdminServices. Use the doEncrypt method as below.

  • Now invoke the PropertiesAdminService AdminService. Use the “SetProperty” method as below:

<ser:path> (Registry location) uses the /_system/config/repoitory/components/secure-vault (always this is the path for this element)

<ser:name> - Vault key

<ser:value> - encrypted value (this value received from the above doEncrypt method).


  • After adding this, you are able to check the password using “wso2:vault-lookup('shadsha12')” xpath expression. Following is sample proxy configuration that is used to check this scenario.

<?xml version="1.0" encoding="UTF-8"?>

<proxy xmlns="http://ws.apache.org/ns/synapse"

       name="testProxy"

       transports="https,http"

       statistics="disable"

       trace="disable"

       startOnLoad="true">

   <target>

      <inSequence>

         <log level="custom">

            <property name="new_Password" expression="wso2:vault-lookup('shadsha12')"/>

         </log>

         <drop/>

      </inSequence>

   </target>

   <description/>

</proxy

  • Received below results when invoking the above service.
 

Please refer [1] for more information on "Calling Admin Services from Apps".

[1] https://docs.wso2.com/display/ESB481/Calling+Admin+Services+from+Apps

How to write custom class mediator to activate/deactivate proxy services created in WSO2 ESB.

To activate/deactivate proxy services which are exposed as "http" without using ServiceAdmin, you could use a class mediator solution. We have used ProxyDeactivator and ProxyActivator class mediators to activate/deactivate proxy services.

Class mediator code for "ProxyDeactivator"


package org.wso2.custom;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;

public class ProxyDeactivator extends AbstractMediator {

    private static final Log log = LogFactory.getLog((Class)ProxyDeactivator.class);

    public boolean mediate(MessageContext context) {
        log.info((Object)"[ProxyDeactivator] --------------Invocation START-------------");

        context.getConfiguration().getProxyService("testProxy").stop(context.getConfiguration());

        log.info((Object)"[ProxyDeactivator] --------------Invocation END-------------");
        return true;
    }
}


To test the above scenario, place the jar created with above configuration inside the <ESB_HOME>/repository/components/lib directory.

Create a proxy service (http) with the above ProxyDeactivator class mediator.


<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testProxy"
       transports="http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="LOG" value="---------inside the InSeq--------"/>
         </log>
         <class name="org.wso2.custom.ProxyDeactivator"/>
         <send>
            <endpoint>
               <address uri="http://www.google.com"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>                              


Invoke the proxy service with below curl command.

curl -v -i -H "Content-Type: application/soap+xml" -H "Accept: application/soap+xml" http://ubuntu-ThinkCentre-M83:8280/services/testProxy


As you could see below proxy service got deactivated after invoking the proxy.



Class mediator code for "ProxyActivator":


package org.wso2.custom;
package org.wso2.custom;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;

public class ProxyActivator extends AbstractMediator {

    private static final Log log = LogFactory.getLog((Class)ProxyActivator.class);

    public boolean mediate(MessageContext context) {

        log.info((Object)"[ProxyActivator] --------------Invocation START-------------");

        context.getConfiguration().getProxyService("testProxy").start(context.getConfiguration());

        log.info((Object)"[ProxyActivator] --------------Invocation END-------------");
        return true;
    }
}


To test the above scenario, place the jar created with above configuration inside the <ESB_HOME>/repository/components/lib directory.

You need to use this inside a separate proxy service and class mediator will activate the proxy inside it


<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testProxy1"
       transports="http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="LOG" value="---------inside the InSeq--------"/>
         </log>
         <class name="org.wso2.custom.ProxyActivator"/>
         <send>
            <endpoint>
               <address uri="http://www.google.com"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>


Invoke the proxy service with below curl command.

curl -v -i -H "Content-Type: application/soap+xml" -H "Accept: application/soap+xml" http://ubuntu-ThinkCentre-M83:8280/services/testProxy1

As you could see below proxy service got activated after invoking the proxy.

Saturday, August 6, 2016

Configuring JMS Synchronous invocation (Dual Channel HTTP-to-JMS) with WSO2 ESB and WebLogic Server Cluster.


This article provides the configuration details and the proxy service samples to connect the ESB as a dual channel HTTP to JMS scenario with WeblLogic Message Queues in a Weblogic cluster. 
Please find the high level architecture related to the scenario in below diagram.
 
Article includes following sections:
  1. Setting up the WebLogic Server
  2. Creating a new WebLogic domain
  3. Administration Server, the Managed Servers, Clusters and Machines configurations
  4. Starting the WebLogic Cluster
  5. Configuring JMS Servers in WebLogic Cluster
  6. Configuring JMS Module, JMS Queue and Connection Factory.
  7. Configuring WSO2 ESB 

This sample is tested with WSO2 ESB 4.9.0, WebLogic 12.1.3, JDK 1.7 and Ubuntu 15.04 environment. 

1. Setting up the WebLogic Server


In order to setup Weblogic 12.1.3 you may download it from the below link.
   
Once you download the generic installer you will receive a jar named – fmw_12.1.3.0.0_wls.jar. Copy that to a specific folder and name the folder as weblogic_home to make it as a location for the installation during the installation. Then using the terminal execute the below command.

            java -jar fmw_12.1.3.0.0_wls.jar


The following screen-shots will provide you installation instructions in order to install the WebLogic server. 

 







  

  


2. Creating a new WebLogic domain


  

 





3. Administration Server, the Managed Servers, Clusters and Machines configurations 


On the Select Optional Configuration screen, select the Administration Server and the Managed Servers, Clusters and Machines options.


On the Configure the Administration Server screen, specify the configuration details for the Administration Server. 


 
On the Configure Managed Servers screen, add managed servers and specify the settings for them. Make sure you specify the actual IP address of the physical machine where you want to host a managed server that is being added. In here we have used only one machine and two ports.

 
On the Configure Clusters screen, add a new cluster and then configure the settings for it.
  

On the Assign Servers to Clusters screen, move the managed servers in the left pane to the right pane, thus assigning them to the cluster.



On the Configure Machines screen, add the machines that will host the managed servers.

 
On the Assign Servers to Machines screen, assign the Administration Server and managed servers in the left pane to the appropriate machines in the right pan.

 

On the Configuration Summary screen, look through the summary of the settings chosen in the wizard and then, if everything is OK, click Create to start the process of domain creation.

 

 

4. Starting the WebLogic Cluster

Start the Administration Server with the startWebLogic.sh script located in the root directory of your domain. After a successful start the terminal will be look as below:
 

  • To access the Administration Console, point your browser to the following address: http://your_domain_host_IP_address:7001/console
  • Navigate to the WL_HOME\server\bin directory and launch the startNodeManager.sh script to start the node manager.
  • Before going any further, make sure that the node managers you just started are reachable. To do that, in the Administration Console, check the Your_Domain->Environment->Machines->Machine_->Monitoring page for each machine.
  • To avoid SSL communication problems, you may use a plain connection to interact with the node manager, which is recommended for testing and development purposes. To do this, you need to edit the WL_HOME/common/nodemanager/nodemanager.properties file, setting the SecureListener property to false. Also be sure to edit the node manager settings in the Administration Console, setting the Type field to Plain in the Machine_->Node Manager tab.
  • Once the status of the node manager for each machine is reachable, you can start the managed servers. In the Administration Console, move to the Your_Domain->Environment->Servers->Control page. Select all the managed servers in the Servers table and then click the Start button.
Before going to the next configurations, please find the high level view of the JMSServer, ConnectionFactory and Message Queue configuration below. 
Follow the below steps to create the JMSServer, JMS Modules, ConnectionFactory and Message Queue on the WebLogic cluster.

5. Configure JMS Servers in WebLogic Cluster.

Login to WebLogic management console using the credentials.









Repeat the same above steps to created the JMSServer-2 and after creating both JMSServer the Summary of JMS Servers will look like below:




6. Configure JMS Module, JMS Queue and Connection Factory.
 
Go to Domain Structure → base_domain → Services → Messaging → JMS Modules and create a new module and follow the screens below.








Repeat the same steps to create the System Module 2 as well and summery of JMS Modules will appear as below:




Then Select the created JMS Module, here it is SystemModule1 and select the tab Subdeployments. Then follow the below screens.





Create the same sub-deployment folder to both servers and add the Jms server 2 and managed server 2 also as the targets.




Select the Module created ( SystemModule1 ) and follow the screens to create the connection factory.
 






Repeat the same steps above and create another connection factory to system module 2 as below:


 
 
Same way to create the queues. Follow the screens as below:
 




You need to create two queues per system module as below:

Repeat the same steps to create queues in system module 2 as well and the summery of system module 2 will look like below:



That is the end of WebLogic side configurations. 

7. Configuring WSO2 ESB

Firstly, you need to create the client jar of WebLogic server to support the WSO2 ESB. Go to /home/ubuntu/Oracle/Middleware/O_H/wlserver/server/lib and run the below command.

java -jar wljarbuilder.jar


This will create a wlfullclient.jar inside the same location. Now you need to remove the javax.jms package and javax.xml.namespace package from the wlfullclient.jar.


In order to achieve this you can follow below two options.

  •   Use the pom.xml in the https://docs.wso2.com/display/ESB490/Configure+with+WebLogic and build the bundle and copied it to ESB_HOME/repository/components/dropins.
  •   Open the wlfullclient.jar using Archive Manager and remove the folders of the below packages manually.
                                 javax.jms
                                 javax.xml.namespace
                                 And copy the jar to ESB_HOME/repository/components/lib.


JMS Listener configuration in axis2.xml


<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">

<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">weblogic.jndi.WLInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">t3://172.22.217.135:7007</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">jms/TestConnectionFactory1</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="transport.jms.UserName" locked="false">weblogic</parameter>
<parameter name="transport.jms.Password" locked="false">1qaz2wsx@</parameter>
</parameter>

<parameter name="myQueueConnectionFactory1" locked="false">
<parameter name="java.naming.factory.initial" locked="false">weblogic.jndi.WLInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">t3://172.22.217.135:7005</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">jms/TestConnectionFactory1</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="transport.jms.UserName" locked="false">weblogic</parameter>
<parameter name="transport.jms.Password" locked="false">1qaz2wsx@</parameter>
</parameter>

</transportReceiver>

JMS Sender configuration in axis2.xml

<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>

Consumer Proxy Service 1

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="WeblogicJMSConsumerProxy1"
       transports="jms"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message Consumed by WeblogicJMSConsumerProxy1--------"/>
         </log>
         <log level="full"/>
         <property name="Accept-Encoding" scope="transport" action="remove"/>
         <property name="Content-Length" scope="transport" action="remove"/>
         <property name="Content-Type" scope="transport" action="remove"/>
         <property name="User-Agent" scope="transport" action="remove"/>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message Sent by WeblogicJMSConsumerProxy1--------"/>
         </log>
         <property name="OUT_ONLY" value="true"/>
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="jms:/jms/TestQueue2?transport.jms.ConnectionFactoryJNDIName=jms/TestConnectionFactory1&amp;java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory&amp;java.naming.provider.url=t3://172.22.217.135:7007&amp;transport.jms.DestinationType=queue"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>contentType</jmsProperty>
         <default>application/xml</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
   <parameter name="transport.jms.Destination">jms/TestQueue1</parameter>
   <description/>
</proxy>

 Consumer Proxy Service 2

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="WeblogicJMSConsumerProxy2"
       transports="jms"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message Consumed by WeblogicJMSConsumerProxy2--------"/>
         </log>
         <log level="full"/>
         <property name="Accept-Encoding" scope="transport" action="remove"/>
         <property name="Content-Length" scope="transport" action="remove"/>
         <property name="Content-Type" scope="transport" action="remove"/>
         <property name="User-Agent" scope="transport" action="remove"/>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message Sent by WeblogicJMSConsumerProxy--------"/>
         </log>
         <property name="OUT_ONLY" value="true"/>
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="jms:/jms/TestQueue2?transport.jms.ConnectionFactoryJNDIName=jms/TestConnectionFactory1&amp;java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory&amp;java.naming.provider.url=t3://172.22.217.135:7005&amp;transport.jms.DestinationType=queue"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>contentType</jmsProperty>
         <default>application/xml</default>
      </rules>
   </parameter>
   <parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory1</parameter>
   <parameter name="transport.jms.Destination">jms/TestQueue1</parameter>
   <description/>
</proxy>

 Producer Proxy Service

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="WeblogicJMSSenderProxy"
       transports="http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="Accept-Encoding" scope="transport" action="remove"/>
         <property name="Content-Length" scope="transport" action="remove"/>
         <property name="Content-Type" scope="transport" action="remove"/>
         <property name="User-Agent" scope="transport" action="remove"/>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message Sent by WeblogicJMSConsumerProxy--------"/>
         </log>
         <send>
            <endpoint>
               <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
                  <endpoint>
                     <address uri="jms:/jms/TestQueue1?transport.jms.ConnectionFactoryJNDIName=jms/TestConnectionFactory1&amp;java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory&amp;java.naming.provider.url=t3://172.22.217.135:7007&amp;transport.jms.DestinationType=queue&amp;transport.jms.ReplyDestination=jms/TestQueue2&amp;transport.jms.ContentTypeProperty=JMSContentType"/>
                  </endpoint>
                  <endpoint>
                     <address uri="jms:/jms/TestQueue1?transport.jms.ConnectionFactoryJNDIName=jms/TestConnectionFactory1&amp;java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory&amp;java.naming.provider.url=t3://172.22.217.135:7005&amp;transport.jms.DestinationType=queue&amp;transport.jms.ReplyDestination=jms/TestQueue2&amp;transport.jms.ContentTypeProperty=JMSContentType"/>
                  </endpoint>
               </loadbalance>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <log level="custom">
            <property name="STATUS:"
                      value="------------------Out sequence invoked---------------------"/>
         </log>
         <log level="full"/>
         <log level="custom">
            <property name="STATUS:"
                      value="------------------Out sequence invoked before setting content type--------------------"/>
         </log>
         <send/>
      </outSequence>
   </target>
   <parameter name="transport.jms.ContentType">
      <rules>
         <jmsProperty>JMSContentType</jmsProperty>
         <default>application/xml</default>
      </rules>
   </parameter>
   <description/>
</proxy>

 Test Results


References

[1] http://www.oracle.com/technetwork/articles/soa/vasiliev-wls-cluster-1867166.html

[2] https://docs.wso2.com/display/ESB490/Configure+with+WebLogic

[3] http://ajanthane.blogspot.com/2016/05/configuring-wso2-esb-with-weblogic.html

[4] http://markchensblog.blogspot.com/2013/02/configure-weblogic-jms-resources.html