Now we need to do the configuration for the hierarchy, which we saw earlier. To do that modify the below ldif and upload it through the administrative context created above.
Below is the content of the load_config.ldif file. Right click on the created Administrative Context partition and load the ldif file.
dn: uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk objectClass: organizationalPerson objectClass: person objectClass: inetOrgPerson objectClass: top cn: admin sn: admin uid: ajanthan userPassword:: batticaloa dn: cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: javaContainer cn: OracleContext dn: cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: XE dn: cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: OracleDBQueues dn: cn=ESBAQADMIN.MESSAGE_QUEUE,cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk orcldbaqpointerattr: cn=ESBAQADMIN.ESB_QUEUE_MESSAGE_TABLE,cn=OracleDBQueuesTables,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk javaClassName: oracle.jms.AQjmsDestination orcldbaqobjname: MESSAGE_QUEUE javaFactory: oracle.jms.AQjmsDestinationFactory objectClass: top objectClass: javaContainer objectClass: javaObject objectClass: javaNamingReference objectClass: orclDBAQObject orcldbaqobjtype: Queue cn: ESBAQADMIN.MESSAGE_QUEUE orcldbaqgeneric: maxretries=3 orcldbaqobjowner: ESBAQADMIN dn: cn=OracleDBQueuesTables,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: OracleDBQueuesTables dn: cn=ESBAQADMIN.ESB_QUEUE_MESSAGE_TABLE,cn=OracleDBQueuesTables,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk orcldbaqobjname: ESB_QUEUE_MESSAGE_TABLE orcldbaqobjtype: QueueTable objectClass: top objectClass: javaContainer objectClass: javaObject objectClass: javaNamingReference objectClass: orclDBAQObject javaClassName: oracle.AQ.AQOracleQueueTable javaFactory: oracle.AQ.AQOracleQueueTableFactory orcldbaqobjowner: ESBAQADMIN orcldbaqgeneric: PayloadType=SYS.AQ$_JMS_TEXT_MESSAGE cn: ESBAQADMIN.ESB_QUEUE_MESSAGE_TABLE dn: cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: orclContainer cn: oracledbconnections dn: cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk objectClass: top objectClass: javaContainer objectClass: javaObject objectClass: javaNamingReference objectClass: orclDBAQConnection javaFactory: oracle.jms.AQjmsConnectionFactory javaClassName: oracle.jms.AQjmsQueueConnectionFactory cn: ESBAQADMIN orcldbaqgeneric: JDBC_connect_string=jdbc:oracle:thin:@localhost:1521:xe orcldbaqgeneric: Username=ESBAQADMIN orcldbaqgeneric: Password=ESBAQADMIN
After the successful load you will get the below screen.
Now we have successfully made the connection between LDAP Server and Oracle AQ Queue.
4) Configuring WSO2 ESB 5.0.0
1) First we need to enable the JMS transport sender and listener. Add the below to the 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">com.sun.jndi.ldap.LdapCtxFactory</parameter> <parameter name="java.naming.provider.url" locked="false">ldap://localhost:10389</parameter> <parameter name="server_dn" locked="false">cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.principal" locked="false">uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.credentials" locked="false">batticaloa</parameter> <parameter name="java.naming.security.authentication" locked="false">simple</parameter> <parameter name="transport.jms.UserName" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.Password" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.ldap.LdapCtxFactory</parameter> <parameter name="java.naming.provider.url" locked="false">ldap://localhost:10389</parameter> <parameter name="server_dn" locked="false">cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.principal" locked="false">uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="java.naming.security.credentials" locked="false">batticaloa</parameter> <parameter name="java.naming.security.authentication" locked="false">simple</parameter> <parameter name="transport.jms.UserName" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.Password" locked="false">esbaqadmin</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> </parameter> </transportReceiver> <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
2) Need to copy the required JARS to ESB_HOME/repository/components/lib folder. You can find the JARS at below link.
https://drive.google.com/file/d/0B-VAIXmh-0yebnEzeVlJekNEeTQ/view?usp=sharing
3) Now start the ESB server. At that time If you get any error as below:
Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - INVALID_CREDENTIALS: Bind failed: ERR_229 Cannot authenticate user uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk] at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3136) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3082)
This is due to the password of the use we specified in the ldif file. We can reset the password using the ApacheDS below screens.
4) Now we are going create the Sender Proxy.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="OracleAQMessageSender" startOnLoad="true" statistics="disable" trace="disable" transports="http,https"> <target> <inSequence> <log level="custom"> <property name="STATUS" value="----------------OracleAQMessageSender Invoked----------------"/> </log> <property name="OUT_ONLY" value="true"/> <property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/> <send> <endpoint> <address uri="jms:/cn=ESBAQADMIN.MESSAGE_QUEUE,cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk?java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory&transport.jms.ConnectionFactoryJNDIName=cn=ESBAQADMIN,cn=oracledbconnections,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk&java.naming.provider.url=ldap://localhost:10389/& transport.jms.DestinationType=queue& server_dn=cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk& java.naming.security.principal=uid=ajanthan,ou=DevOpsTeam,o=wso2,c=lk&java.naming.security.credentials=batticaloa& java.naming.security.authentication=simple&transport.jms.UserName=esbaqadmin&transport.jms.Password=esbaqadmin"/> </endpoint> </send> </inSequence> </target> <description/> </proxy>
5) Now send the message. The sample message sent from SOAP UI as below:
We can check whether the queue received the message using below Screen.
6) Now we will check the listener Proxy. Create a proxy as below:
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="OracleAQListenerProxy" startOnLoad="true" statistics="disable" trace="disable" transports="jms"> <target> <inSequence> <log level="full"/> <drop/> </inSequence> </target> <parameter name="transport.jms.Destination">cn=ESBAQADMIN.MESSAGE_QUEUE,cn=OracleDBQueues,cn=XE,cn=OracleContext,ou=DevOpsTeam,o=wso2,c=lk</parameter> <parameter name="transport.jms.ContentType"> <rules xmlns=""> <jmsProperty>ContentType</jmsProperty> <default>text/plain</default> </rules> </parameter> <description/> </proxy>
7) The carbon log will show the message read from the queue.
[2017-03-18 21:14:52,391] INFO - LogMediator To: , WSAction: "urn:mediate", SOAPAction: "urn:mediate", MessageID: ID:4B042CCE936269E8E050007F01014B5F, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns4:text xmlns:axis2ns4="http://ws.apache.org/commons/ns/payload">ajanthan test AQ Sender </axis2ns4:text></soapenv:Body></soapenv:Envelope>
That's all. We have successfully configured WSO2 ESB with Oracle AQ through LDAP Server.
No comments:
Post a Comment