Thursday, September 4, 2014

REST Service in 12C OSB and SOA

In this blog I would like to explain how to use the  REST Adapter from SOA as well as in OSB in the 12C Release of Oracle SOA Suite

In this exercise a REST service implemented in BPEL acts as provider and OSB will have a REST  client. Both will use the REST Adapter feature.

Step 1: Create an xml schema as follows(RestSchema.xsd)

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vrs="http://test.schemas/RESTSchema"
targetNamespace="http://test.schemas/RESTSchema" elementFormDefault="qualified">
<xsd:element name="request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="message" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Step2: Create a SOA project in12C Jdev

Step 3: Open the projectname.xml(composite.xml) file  and add a REST Adapter to the exposed Service Section


Step4:  Choose the type as Service. From the operational bindings add Operation Binding

Step5:
In the request tab choose the payload type as XML, JSON or URL_Encoded. Choose the  request element from the RESTschema.xsd for the request type


Step6: In the response tab choose the payload type as XML or JSON. Choose the request element from the RESTSchema.xsd



Step7: Add a mediator and BPEL process and wire them as shown below

Step 8 : Configure the BPEL process as below




Step 9: Map the mediator as shown below
Step10 : Deploy the composite

Step 11: Now create new OSB Project. We can use the same schema in OSB service as well

Add the REST Binding to  External Services section

Step 12 :  Configure the REST Binding as follows. Select the payload type as XML/JSON. Select the request element from the RestSchema.xsd

Step13: On clicking OK it will create a business service as shown below


Step 14 : Deploy the OSB service and test  the business service using the osb test console


Monday, July 28, 2014

Get the thread dump for weblogic server from command prompt

Open the command prompt and type jps.
This will give the PID of the server.
>jps

Then type jstack <PID> on command prompt . This will give the thread dump
>jstack 3176

How to get garbage collection statistics

Get the ProcessID using jps command
Then execute the jstat command with the following option
-gccause
-h10  : number of lines
-<PID> : processID
-2000 : time interval


D:\>jstat -gccause -h10 3176 2000
  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC
 27.88   0.00  32.55  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC
 27.88   0.00  32.56  24.67  47.10     16    1.074     0    0.000    1.074 unknown GCCause      No GC


Where S0 and S1 are survivor spaces
 E is Eden space
 O Old Generation Size
 P Permanent generation
YGC Young Garbage Collection
YGCT Time taken for Young Garbage Collection
FGC FullGarbage Collection
FGCT Time taken for  FullGarbage Collection
GCT Total Garbage Collection Time

How to get the ProcessID of weblogic server in windows

Open the command prompt and type the command jps. This will give the process and their IDs as shown below. The ID corresponding to Server is the weblogic server processId


How to configure JMX Port for weblogic managed servers

There could be situations we need to set JMX Port on the managed servers to allow monitoring tools like VisualVM to connect to the managed server and get the server statistics.

 To configure the JMX port just add the following as the arguments for JVM in the setDomainEnv.sh or setDomainENV.cmd as shown below

-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8500 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder

Monday, June 16, 2014

Consumer is not getting listed for JMS Queue

Sometimes even though the JMS Queue and ConnectionFactory is existing in the JMS Module and the JMSAdpater Outbound connection pool JNDI  rightly points to the ConnectionFactory, still we may encounter issues like the consumer is not getting listed for the queue even after the BPEL consumer code deployed properly

In such cases follow this below rules


  • Check the persistent store is created and targeted to the SOA Managed Server
  • Check the JMS server is referring to the above persistent store and targeted to the SOA Managed Server
  • Ensure the JMS Module has a subdeployment , which is targetted to the above JMSServer
  • Ensure the ConnectionFactory/Queue/Topic has targettted to the above subdeployment
  • Finally ensure the queue is existing in the JNDI tree. (console->Environment->Servers->SOAManagedServer->JNDI tree Icon)


Only if the Queue/Topic/ConnectionFactory exist in the Managed Servers JNDI tree , the consumer component can connect to it

Saturday, March 1, 2014

this unique/primary key is referenced by some foreign keys

Sometimes while trying to drop the constraint we may encounter some issues as described below

SQL Error: ORA-02273: this unique/primary key is referenced by some foreign keys
02273. 00000 -  "this unique/primary key is referenced by some foreign keys"
*Cause:    Self-evident.
*Action:   Remove all references to the key before the key is to be dropped.

This issue can be fixed by adding the keyword 'CASCADE' at the end of the contraint drop statement

ALTER TABLE USER DROP CONSTRAINT USER_CON CASCADE;