Saturday, December 7, 2013

Call REST Web service from OSB

Call REST Web service from OSB

Define Business Service:

a. In Business Service General Tab select Service Type as Messaging Service.
b. In Messaging Tab select Request Message Type as None and Response Message Type as Text Requirement>
c. In Transport Tab, select protocol as http and at Endpoint URI section give      REST service URI.
d. In HTTP Transport Tab, select GET for HTTP Request Method

Define Prosy Service:
a. Create Proxy Service with following details
b. At Message Tab: select Message Type as Messaging Service 
c. At Messaging Tab: select Request Message Type as xml and Response            Message Type as XML
d. At Message Flow Tab: add Routing Action and Rout to earlier created               usiness service. 

e. Add three Insert actions at Routing Request Action as shown in image. 

In first insert activity, set following property.
Expression: GET
Location: as first child of
Xpath : ./ctx:transport/ctx:request

In Variable: Outbound


Select second Insert action and set the below property,
Expression:
Location: as first child of
XPath: ./ctx:transport/ctx:request
In Variable: outbound 

Set below value in third insert action:
Expression: ,
Note: give value to http:query-parameters, use ‘,’ to give multiple query-parameters
Location: as first child of
XPath: ./ctx:transport/ctx:request/http:query-parameters
In Variable: outbound 

Test the proxy.

Database Adapter in OSB 11g

Database Adapter in OSB 11g

Oracle Service Bus does not have facility to create the Database Adapter directly (In Eclipse OEPE does not have option to create the DB Adapter). To achieve this, we can use the Oracle JDeveloper to create the DB Adapter and then import the resources like JCA, wsdl and xsd into the OSB project from JDeveloper. Using above mentioned files we can avail the DB Adapter features in OSB.

Steps:
1. Create Database Adapter using oracle Jdeveloper.
2. Import .jca, wsdl, and xsd files into the OSB project and create business service using .JCA 
3. Create Datasource and connection factory in weblogic server.

1 Create Database Adapter using oracle Jdeveloper.
Create a new SOA project in Jdeveloper.



Drag and drop a DB Adapter in the composite; it opens DB Adapter configuration wizard.
Provide service Name, JNDI Name and select the operations which would you like to perform in Database as select, update and delete.




Import the table 



Click next to all the windows and Finish.


Now the DBAdapter, JCA, wsdl and xsd file has created in Jdeveloper.

2 Import the Resources into the OSB project and create business service using JCA file.


a) Create OSB Configuration and OSB project if you don’t have it already.
b) Right click in newly created OSB project and select import > import. It opens import window, in General select File Systems and click next. 
c) Goto the Jdeveloper project location and select the .jca, wsdl, and xsd file and click finish.





d) Now the files are copied into your osb project.
e) In .jca file right click select Oracle Service Bus > Generate Service.


f) It creates business service for you.

g) Open the business service (.biz file) and select “Transport” tap at bottom, check the protocol is selected as “jca”.

This business service act as interface for Database. Open the JCA file and see the JCA configuration details.

Create Data source and connection factory in weblogic server.

a) Login to weblogic console goto JDBC > Datasource , Create Datasource with JNDI alias





b) In weblogic Domain Structure select Deployments > select DbAdapter > Configuration > Outbound Connection pool > New


c) Give the JNDI name, it should match the name which one u given while creating the DB Adapter.
d) Goto the Outbound Connection property > edit the property value of xADataSourceName and hide Enter key to save it. (jdbc/testDatasource)
e) Update the DbAdapter to activate the configuration changes.
f) Deploy the business service and test.

BINDING.JCA-12511

BINDING.JCA-12511


DB interaction failure in some of the servers, even after the deployment was successful, any DB actions from nodes other than primary node failed with following error:

#### <[ACTIVE] ExecuteThread: '89' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <18ad0897b9b46ad4:-2bb4c844:13db9225527:-7ffd-000000000009dd5c> <1364640266308>
#### <[ACTIVE] ExecuteThread: '89' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <18ad0897b9b46ad4:-2bb4c844:13db9225527:-7ffd-000000000009dd5c> <1364640266316>

BINDING.JCA-12511
JCA Binding Component connection issue.
JCA Binding Component is unable to create an outbound JCA (CCI) connection.
servicebus WSDL/TestSerivce/Test/ServiceEngines/DBAdapter [ DBAdapter_ptt::DBAdapter(DBAdapterInput_msg,DBAdapterOutputCollection) ] - : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12561
JCA Resource Adapter location error (WebLogic).
Unable to locate the JCA Resource Adapter via .jca binding file element
The JCA Binding Component is unable to startup the Resource Adapter specified in the element:  location='eis/DB/TestDB'.
The reason for this is most likely that either
1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic J2EE Application server or
2) the JNDI setting in the WebLogic JCA deployment descriptor has not been set to eis/DB/TestDB. In the last case you might have to add a new 'connector-factory' entry (connection) to the deployment descriptor.
Please correct this and then restart the WebLogic Application Server

Please make sure that the JCA connection factory and any dependent connection factories have been configured with a sufficient limit for max connections. Please also make sure that the physical connection to the backend EIS is available and the backend itself is accepting connections.

        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFPort_JCA$JCAConnectionPool.createJCAConnectionFactory(WSIFPort_JCA.java:1625)
        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFPort_JCA$JCAConnectionPool.newPoolObject(WSIFPort_JCA.java:1487)
        at oracle.tip.adapter.sa.impl.fw.common.ObjectPool.checkOut(ObjectPool.java:177)
        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFPort_JCA$JCAConnectionPool.checkOut(WSIFPort_JCA.java:1696)
        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFPort_JCA.obtainJCAConnection(WSIFPort_JCA.java:1016)
        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFOperation_JCA.performOperation(WSIFOperation_JCA.java:406)
        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFOperation_JCA.executeOperation(WSIFOperation_JCA.java:365)
        at oracle.tip.adapter.sa.impl.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation(WSIFOperation_JCA.java:324)
        at oracle.tip.adapter.sa.impl.JCABindingReferenceImpl.invokeWsifProvider(JCABindingReferenceImpl.java:344)
        at oracle.tip.adapter.sa.impl.JCABindingReferenceImpl.request(JCABindingReferenceImpl.java:256)
        at com.bea.wli.sb.transports.jca.binding.JCATransportOutboundOperationBindingServiceImpl.invoke(JCATransportOutboundOperationBindingServiceImpl.java:150)
        at com.bea.wli.sb.transports.jca.JCATransportEndpoint.sendRequestResponse(JCATransportEndpoint.java:209)
        at com.bea.wli.sb.transports.jca.JCATransportEndpoint.send(JCATransportEndpoint.java:170)
        at com.bea.wli.sb.transports.jca.JCATransportProvider.sendMessageAsync(JCATransportProvider.java:575)
        at sun.reflect.GeneratedMethodAccessor497.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.bea.wli.sb.transports.Util$1.invoke(Util.java:83)
        at $Proxy143.sendMessageAsync(Unknown Source)

In weblogic console, under testing tab of DBAdapter.rar all outbound connection pools were not visible. The issue is that updated Plan.xml is not replicated to all other nodes. You have to manually copy the Plan.xml containing all outbound connection pool to all server instance nodes. 

Perform below steps in server:
ORACLE_HOME/soa/Plan.xml
  • Copy the Plan.xml containing all outbound connection pool to all nodes
  • Update the connector application DBAdapter.rar
  • Restart DBAdapter.rar and Application server instance

Quartz Scheduler in SOA 11g.

Quartz Scheduler in SOA 11g.


It helps you to schedule the BPEL process with simple configuration changes.

1. Down load Quartz from http://www.terracotta.org/download/reflector.jsp?b=tcdistributions&i=quartz-1.8.4.tar.gz

2. Unzip the contents to your local directory.

3. Extract the attached GenericQuartzScheduler.zip to your local directory.

4. Open the GenericQuartzScheduler workspace in jdeveloper. It contains MinProject and EchoService.

5. Deploy EchoService into em

6. Right click on MainProject, select “Project Properties”. Go to “Libraries and Classpath” and modify the Library path of bellow jars from your local (all the jars are there in “quartz-1.8.4”, downloaded from step 1).

D:\quartz-1.8.4\quartz-1.8.4-all.jar

D:\quartz-1.8.4\lib\log4j-1.2.14.jar,

D:\quartz-1.8.4\lib\slf4j-api-1.6.0.jar

D:\quartz-1.8.4\lib\slf4j-log4j12-1.6.0.jar

7. Change the context.properties by modifying the target.hostname and target.port to reflect your target BPEL server host and port.

8. Change the quartz_jobs.xml as per your requirements

9. Clean and rebuild the MainProject and Deploy the Main Application to WAR file.

10. Through weblogic admin console install the WAR. Select target as Admin Server.

11. Verify Deployment and Active Changes and Start the application.

12. EchoService is automatically triggered and you can see the new instance in em console.

Changing Quartz_Jobx.xml – The configuration of quartz_jobs.xml is defined in Quartz official document. Take care below three parameters,

end-point-url: The endpoint uri of webservice or BPEL process.

process: The SOAp action or the BPEL process’s WSDL operation.

input-data: optional input to the webservice


Wednesday, June 13, 2012

Create/add Custom Xpath to OSB/osb eclipse
1.       Create java project with point 2 and 3 (it should have .properties and xml file).
2.       Create your java class and method to perform your operation.
3.       Add properties and xml
Create common-functions.Properties file with below two lines.
%OSB_FUNCTIONS%=Service Bus Functions
%FUNC_COMMON_COMMENT%=Utility function methods
Create common-functions.xml as,
xml version="1.0" encoding="UTF-8"?>
<xpf:xpathFunctions xmlns:xpf="http://www.bea.com/wli/sb/xpath/config">
    <xpf:category id="%OSB_FUNCTIONS%">     
        
         <xpf:function>
                <xpf:name>retrunStrxpf:name>
                <xpf:comment>%FUNC_COMMON_COMMENT%xpf:comment>
                <xpf:namespaceURI>http://www.test.com/xquery/Common-functions/testxpathxpf:namespaceURI>
                <xpf:className>com.service.util.TestCustomXpathxpf:className>
                <xpf:method>java.lang.String retrunStr(java.lang.String)xpf:method>
                <xpf:isDeterministic>falsexpf:isDeterministic>
                <xpf:scope>Pipelinexpf:scope>
                <xpf:scope>SplitJoinxpf:scope>
         xpf:function>
        
    xpf:category>
xpf:xpathFunctions>

4.       Export the above java project as jar file.
5.       Copy the jar, common-functions.Properties and common-functions.xml files into


\Oracle\Middleware\Oracle_OSB1\config\xpath-functions
6.       Restart the eclipse, now your custom function is ready to use it in OSB (xquery).
7.       In OSP add the name space, http://www.test.com/xquery/Common-functions/testxpath which is given in common-functions.xml and call your custom function as, tst:returnStr("test”)
8.       Done.



Thursday, May 17, 2012

Xquery to handle default namespace






1234



25



0

Success











xquery to get the value of ErrorCode and ErrorMessage from above xml.

The Response element has name space as http://abc.xyz.com/test/schemas and it doesn’t have prefixed so all the elements under Response element prefix with some default namespace. To cover up this write xquery as

data($body/*:Response/*:DetailResponse/*:Error/*:ErrorCode)

data($body/*:Response/*:DetailResponse/*:Error/*:ErrorMessage)



Tuesday, April 17, 2012

Step to setup Meta Data Store (MDS) in Weblogic server using Jdeveloper – SOA 11g


 It helps to reuse of SOA Artifacts such as wsdl, xsd, and fault policy, ect… 

MDS connection can be “File Base MDS” or “DB Based MDS”.

Under “/ integration/seed/” create dir as “apps” if it is not there.  Under apps create your own dir and store your xsd, wsdl, ect… it should match your schema structure.

Steps to create SOA_MDS connection in Jdeveloper, Go to New à Connection àSOA-MDS Connection,

 
In “SOA-MDS Connection” screen select connection Type “DB Based MDS” or “File Based MDS”

To use the MDS xsd or wsdl file add an entry in Application Resources à Descriptors à ADF-META-INFà adf-config.xml

  
         namespace metadata-store-usage="mstore-usage_2" path="/apps/bs"/
       

property value="C:/Oracle/Middleware/jdeveloper/integration"                       
 name="metadata-path"
Go to “Application Resources” and open adf-config.xml file 

          


In composite refer as “oramds:/apps/bs/xsd/Test.xsd”


Deploy MDS Repository to Weblogic Server.
Create SOA Application and SOA project with empty composite. In SOA Project, under “SOA content” create your own directory structure to arrange you xsd, wsdl and fault policy files, etc…

To deploy the MDS, right click on MDSApplication and select Deploy

In deployment Action Screen selects “Deploy to SOA Bundle” and finish the deployment.

It creates .zip file under your application location as Boundle.zip.

Deploy this file into corresponding em console partition.