Monday, October 27, 2014

Namespace value in SOAPAction does not match Namespace value 'http://schemas.xmlsoap.org/soap/envelope/' in xml tag 'Body'

This issue normally comes when we use Service Callout.

Service Callout has an option to  configure Body or Payload

Payload means , it will be send as a child of Body.

If you pass your request which is already a SOAP Body as a payload,  and if you select Payload Document Option it will be like sending a SOAP Body inside SOAP Body. That might result the above error.

In such cases choose wisely which option you need to select while sending request via service callout

If your request itself is a SOAPBody choose the SOAP Body option. Otherwise choose the payload option


Tuesday, October 21, 2014

How to install a maven plugin to the central repository

If you want to install a plugin to the central repository like Archiva or Artifactory, follow the below steps

1) Download the plugin jar from
2) Extract the jar file and from the META_INF folder copy the path to POM file
3) Open the command prompt and navigate to the directory where the jar and POM file resides
4) Run the following command by replacing the jar file name and pom name

For eg. to install  properties-maven-plugin-1.0-alpha-2.jar to central repository

mvn deploy:deploy-file -DpomFile=<path_to>\properties-maven-plugin-1.0-alpha-2\META-INF\maven\org.codehaus.mojo\properties-maven
-plugin\pom.xml -Dfile=properties-maven-plugin-1.0-alpha-2.jar -Durl=http://localhost:8091/artifactory/internal -DrepositoryId=internal


Now to use this plugin along with your POM file add the following section  in the POM file under the plugin section

 <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0-alpha-2</version>
                <executions>
                  <execution>
                    <phase>initialize</phase>
                    <goals>
                      <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                      <files>
                        <file>build-${deploy}.properties</file>
                      </files>
                    </configuration>
                  </execution>
                </executions>
              </plugin>

Thursday, October 9, 2014

12C OSB DVM usage :oracle.tip.dvm.exception.DVMValidationException: Unable to get Metadata Manager

When we use DVM in OSB 12c, during runtime there is a possibility to encounter a below as given below

weblogic.work.ExecuteThread.run(ExecuteThread.java:263) Caused by: oracle.tip.dvm.exception.DVMValidationException: Unable to get Metadata Manager for DVM "xxx.dvm" Please ensure the Metadata Manager is available. at oracle.tip.dvm.DVMManagerImpl.getDVMRTObject(DVMManagerImpl.java:223) at oracle.tip.dvm.DVMManagerImpl.lookupValue(DVMManagerImpl.java:88) at com.bea.wli.sb.functions.dvm.DVMFunctions.lookupValue(DVMFunctions.java:40) ... 78 more

This could be due to the fact that process is not able to locate the dvm file. If the DVM file is part of your project ensure you refer that in the dvm lookup fuction as given below

dvm:lookup('<projectname>/<relativepathToDVMfile>.dvm', 'PROPERTY_KEY', 'key', 'PROPERTY_VALUE', ' ')

Oracle Maven Sync Plugin Installation : Return code is: 401, ReasonPhrase: Unauthorized

While trying to install the maven-sync-plugin to a centralized repository like Archiva/Artifactory

sometimes an authorization error happens as follows

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:
deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts:
 Could not transfer artifact com.oracle.maven:oracle-maven-sync:jar:12.1.3-0-0 f
rom/to remote-repository (http://localhost:8091/artifactory/internal): Failed to
 transfer file: http://localhost:8091/artifactory/internal/com/oracle/maven/orac
le-maven-sync/12.1.3-0-0/oracle-maven-sync-12.1.3-0-0.jar. Return code is: 401,
ReasonPhrase: Unauthorized. -> [Help 1]

This can be resolved by doing the following steps

1) Create a new user called demouser in the Archiva/Artifactory
2) Give the permissions to the user to the desired repositories
3) encrypt the password using the command mvn -ep <password>

4)Use the encrypted password in the settings.xml, as shown below

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <profiles>
    <profile>
      <id>default</id>
      <repositories>
        <repository>
          <id>internal</id>
          <name>internal</name>
          <url>http://localhost:8091/artifactory/internal</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>snapshot</id>
          <name>snapshot</name>
          <url>http://localhost:8091/artifactory/snapshot</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>default</activeProfile>
  </activeProfiles>
  <mirrors>
    <mirror>
      <id>mirror</id>
      <name>mirror</name>
      <url>http://localhost:8091/artifactory/repo1</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  <servers>
    <server>
      <id>internal</id>
     <username>demouser</username>
   <password>{y2ZZOfE4lLkH78iLLX9xLQjL2/Rkoocq/Yq5HrACJdM=}</password>
   </server>
    <server>
      <id>snapshot</id>
     <username>demouser</username>
  <password>{y2ZZOfE4lLkH78iLLX9xLQjL2/Rkoocq/Yq5HrACJdM=}</password>
    </server>
  </servers>
</settings>

6)Also create a master password using mvn -emp <masterpassword>

7)Create a settings-security.xml with the encrypted master password as shown below
 Note: replace your master password inside the <master> tag

<settingsSecurity>
  <master>{nng7rwwwwKMHM+yJE3201WFQ1WlzYUfgoZGxW2mIcTc=}</master>
</settingsSecurity>

8)Place this  settings.xml and settings-security.xml  under <userhome>/.m2 directory

9) Now execute the install command as follows.

open the command prompt

Navigate to <ORACLE_HOME>\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3

The execute the following command at the prompt :

mvn deploy:deploy-file -DpomFile=oracle-mave
n-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -Durl=http://localhost:8091/artifactory/internal -DrepositoryId=internal

Note : Ensure the  -DrepositoryId is spelled as given in the above command(case sensitive).  Don't use  -DRepositoryId

10)Once this command runs successfully, then execute the push goal as shown below

mvn com.oracle.maven:oracle-maven-sync:push
-DoracleHome=C:\installed\Oracle\Middleware12C\Oracle_Home  -DserverId=internal

This too will now run successfully and your repository will now have all the necessary artifacts installed .

11) To validate your installation run the following command. This will show all the availble goals which you can now use

mvn help:describe -DgroupId=com.oracle.soa.plugin -DartifactId=oracle-soa-plugin -Dversion=12.1.3-0-0

The result will be as follows
====================================
This plugin has 6 goals:

oracle-soa:compile
  Description: Compiles the composite. Note that 'compiling' a composite does
    not actually produce any new files, it is really a 'validation' and
    produces only output messages.

oracle-soa:deploy
  Description: To deploy a SOA composite (supports all formats SAR, MAR,
    etc.)

oracle-soa:help
  Description: Display help information on oracle-soa-plugin.
    Call mvn oracle-soa:help -Ddetail=true -Dgoal=<goal-name> to display
    parameter details.

oracle-soa:sar
  Description: Packages the composite into a SAR.

oracle-soa:test
  Description: To execute SCA Test Suites.

oracle-soa:undeploy
  Description: Undeploy a SOA composite from a SOA managed server or cluster

For more information, run 'mvn help:describe [...] -Ddetail'

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

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