Oracle SOA Suite Online Training

Interested in learning Oracle SOA Suite 12c?
Learn from the author of this blog!
A complete and comprehensive course on the #1 platform on SOA - Oracle SOA Suite

Click here to find the complete course details
Click here to check the first session on Oracle SOA Suite 12c

================================================================================================

The assign activity of the to node query is returning zero node.

Exception :
<selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
   <part name="summary">
      <summary>XPath query string returns zero node.
The assign activity of the to node query is returning zero node.
Either the to node data or the xpath query in the to node was invalid.
According to BPEL4WS spec 1.1 section 14.3, verify the to node value at line number 830 in the BPEL source.</summary>
   </part>
</selectionFailure>


This happens when the TO/Target node that you are assigning is null.
This usually happens when the element is optional, and you assign a value when the element is not having a value. In such cases, you can use the 'ignoreMissingToData' by right clicking the individual assignment in the assign activity.

In cases where you are dealing with arrays, visit this post

Appending repeating elements using Assign

Criteria element in the following schema repeats - and is Optional aswell




You might want to add some <Criteria> elements to your XML.
You can do this either in Assign activity or XSLT.

Using Assign Activity

First, append the <Criteria> element those number of times that you want the array to be.
Remember that the Criteria element before appending has to exist. Otherwise, only the parent <Criteria> tag gets appended and the children (KeyName, KeyValue) doesn't get appended, and you will get the following error in the assign activity

<selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
   <part name="summary">
      <summary>XPath query string returns zero node.
The assign activity of the to node query is returning zero node.
Either the to node data or the xpath query in the to node was invalid.
According to BPEL4WS spec 1.1 section 14.3, verify the to node value at line number 830 in the BPEL source.</summary>
   </part>
</selectionFailure>

If you feel the <Criteria> element might be null, first you stuff the first element, and then append.
Something like this

Next, APPEND the <Criteria[1]> (which you had just created) from the variable to the same variable those number of times that you want the array to be.

Note : If you don't specify the '[]' / Array nomenclature, the assignment happens even if the element is null. But if you specify the '[]' / Array nomenclature, you have to have the element. Otherwise, you will get the error mentioned above.

 Using XSLT

Using XSLT is straight forward.
You can loop over the source elements and assign the values.
If the source elements from which you want to copy the values are not in a loop, and if you know exactly how many array elements you want to add, go to the source editor of the xslt and manually add the elements, something like this

<criteria>
    <KeyName>SomeHardKey1</KeyName>
    <KeyValue><xslt:value-of select="..."/></KeyValue>
</criteria><criteria>
    <KeyName>SomeHardKey2</KeyName>
    <KeyValue><xslt:value-of select="..."/></KeyValue>
</criteria>
...

Hope it helps!
Thanks.

WSDLException: faultCode=OTHER_ERROR: Database Type not supported

Sometimes, while creating a dbAdapter for a stored procedure, you can browse the SP from the database adapter wizard, but when you click on finish, you might encounter the following error


WSDLException: faultCode=OTHER_ERROR: Database Type not supported
Encountered a database type XX that is either not supported or is not implemented.
Parameter YY is of type ZZ which is either not supported or is not an implemented datatype



This happens when the user you are using to connect to the database from the Database Adapter wizard is not given grants to the stored procedure.
Everytime the Stored Procedure or its types are modified in the db, grants to this user has to be given again.

Weblogic Server startup problem after password change

When you change the password of weblogic in console and restart, you might endup with the following error - due to the fact that the new password might not sync in all the places

<21-Feb-2014 11:58:22 o'clock GMT> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.
weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted.
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:960)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1054)
at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)
at weblogic.security.SecurityService.start(SecurityService.java:141)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused By: javax.security.auth.login.FailedLoginException: [Security:090304]Authentication Failed: User weblogic javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User weblogic denied

at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:261)
...
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
>
<21-Feb-2014 11:58:22 o'clock GMT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<21-Feb-2014 11:58:22 o'clock GMT> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<21-Feb-2014 11:58:22 o'clock GMT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>
<21-Feb-2014 11:58:22 o'clock GMT> <Info> <WebLogicServer> <BEA-000236> <Stopping execute threads.> 


For this,
Navigate to /oracle/fmwhome/user_projects/domains/dev_soa_osb/servers/AdminServer/data
Remove complete ldap folder
Remove boot.properties in /oracle/fmwhome/user_projects/domains/dev_soa_osb/servers/AdminServer/security
Restart

Upload assets to OER from local machine

When you create a new Asset in OER, by default, OER 'Asset Submission' windows gives only 'Attach file by reference' / http url option.
To upload files from local into OER, you first have to enable the local upload option. It can done in the following way

Login to OER console using admin credentials
Go to Admin --> System Settings --> Search for the property 'cmee.server.paths.upload' and provide the path for the uploaded assets to be saved --> Save



Enable Policy tab in Oracle Enterprise Repository

Policies enable asset compliance requirements to be enforced. You can have your custom policies defined based on your enterprise group policy.

By default, Policy tab is not enabled in OER. You can enable it in the following way

Login to OER console using admin credentials
Go to Admin --> System Settings --> Search for the property 'cmee.asset-policy.enable' and set it to true --> Save



Clear MDS Cache

Whenever there is a change in MDS artifacts, and the change do not reflect, or you get a 'duplicate' instance issue, clear MDS cache.

You can clear MDS cache via EM



Open .jnlp files in Linux

when you open the .jnlp files in linux directly, it might not work.
You just have to go to the javaws path in your jdk installation, and issue the following command

javaws /complete/path/of/jnlp

And it runs!

Oracle Service Registry Installation - Schema Requirements

Just like any other fusion product installations, OSR also needs certain schemas to be in Oracle database prior to installation.

Though we don't have any readymade RCU like in SOA, the schemas required for OSR installation are very few, so execute the following commands

Log into Oracle (system or DBA privileges are required).
Create a data tablespace named OSR_TABLESPACE with at least 50M of available space.

CREATE TABLESPACE OSR_TABLESPACE LOGGING
 DATAFILE 'OSR.DBF' SIZE 50M REUSE AUTOEXTEND
 ON NEXT 10M MAXSIZE UNLIMITED
 DEFAULT STORAGE (
  INITIAL 5M
  NEXT 5M
  MINEXTENTS 1
  MAXEXTENTS UNLIMITED
  PCTINCREASE 50);

CREATE USER OSR
 PROFILE DEFAULT
 IDENTIFIED BY welcome1
 DEFAULT TABLESPACE OSR_TABLESPACE
 TEMPORARY TABLESPACE TEMP
 ACCOUNT UNLOCK;

GRANT CONNECT TO OSR;
GRANT RESOURCE TO OSR;
GRANT UNLIMITED TABLESPACE TO OSR;
GRANT CREATE ANY SYNONYM TO OSR;
GRANT DROP ANY SYNONYM TO OSR;

Once the above sql's are executed, run the installer.
Hope this helps.

Oracle Enterprise Repository Installation - Schema Requirements

Just like any other fusion product installations, OER also needs certain schemas to be in Oracle database prior to installation.

Though we don't have any readymade RCU like in SOA, the schemas required for OER installation are very few, so execute the following commands

Log into Oracle (system or DBA privileges are required).
Create a data tablespace named OER_DATA with at least 300M of available space.
Create an index tablespace named OER_INDEX with at least 300M of available space.

CREATE TABLESPACE OER_DATA
 DATAFILE 'oer_data.dbf' SIZE 100M AUTOEXTEND ON
NEXT 10240K MAXSIZE UNLIMITED
 EXTENT MANAGEMENT LOCAL AUTOALLOCATE
 LOGGING
 ONLINE
 SEGMENT SPACE MANAGEMENT AUTO;

CREATE TABLESPACE OER_INDEX
 DATAFILE 'oer_index.dbf' SIZE 100M AUTOEXTEND
ON NEXT 5120K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
 LOGGING
 ONLINE
 SEGMENT SPACE MANAGEMENT AUTO;

CREATE USER OER IDENTIFIED BY welcome1
DEFAULT TABLESPACE OER_DATA
 TEMPORARY TABLESPACE TEMP
 PROFILE DEFAULT
 ACCOUNT UNLOCK;
GRANT "CONNECT" TO OER;
ALTER USER OER DEFAULT ROLE "CONNECT", "RESOURCE";
GRANT CREATE MATERIALIZED VIEW TO OER;
GRANT CREATE SEQUENCE TO OER;
GRANT CREATE SESSION TO OER;
GRANT CREATE SYNONYM TO OER;
GRANT CREATE SNAPSHOT TO OER;
GRANT CREATE TABLE TO OER;
GRANT CREATE TRIGGER TO OER;
GRANT CREATE VIEW TO OER;
GRANT UNLIMITED TABLESPACE TO OER;

Once the above sql's are executed, run the installer.
During installation process, one step is to provide the tablespace names. Use the following names
Data : OER_DATA
Blob : OER_DATA
Index : OER_INDEX
Username : OER
Password : welcome1

Hope this helps.

Enable access to specific ports from Oracle VM VirtualBox to Windows host

Sometimes, you may come across a situation where you'll be able to access certain ports from Oracle VM VirtualBox, but not other. This is because those particualar ports are not given access to the host system

Inorder to enable the port,
Go to VM box --> click on the VM --> Settings --> Network --> Port Forwarding --> Add your entry




Message Encryption setup

<<This post is at high level, will modify later :) >>

Encryption is a way to achieve the confidentiality and message integrity which assures a request sent is not tampered and can be decrypted by a party of your interest.

Message encryption requires certificate exchange between the communicating parties.

This is how a communication in case of message encryption happens

Consider Party1 is talking to Party2
Party1 first encrypts the message using Party2's public key, and signs the message with Party1's private key.
When the message is received by Party2, it will first verify the signature key in the message, which is Party1's public key, which should be already present in Party2's keystore, and then will decrypt the message with Party2's private key

This sounds confusing, but very simple. Just public-key exchange with each other.
In case of party1, it'll use one key for encrypting and one for signing
In case of party2, it'll use one for trusting the message, and one for decrypting in case.

Generating a custom keystore and a private key
keytool -genkeypair -alias samlserver -keyalg RSA -keypass samlserver -keystore samlserver.jks -storepass samlserver

Exporting a certificate/your public key
keytool -exportcert -alias samlserver -keystore samlserver.jks -storepass samlserver -file samlserver.cer
keytool -list -keystore samlserver.jks

Importing a certificate / peer's public key
keytool -importcert -alias samlclient -keystore samlserver.jks -storepass samlserver -file samlclient.cer

Print a Certificate
keytool -printcert -file samlclient.cer

Delete a Certificate from keystore
Keytool -delete -alias <aliasName> -keystore <keystoreName> -storepass <keystorePassword>

Delete a Keystore
keytool -delete -alias samlserver-keystore samlserver.jks

Create a certificate request to CA
keytool -certreq -alias test -sigalg "RSAwithSHA1" -file certreq_file -storetype jks -keystore test.jks

Note that if you import a certificate with an already existing alias name, it gets overridden. This is used when you are using your certificate for signing (self-signing) initially, and later get a certificate from a CA in which case you'll override 

Replace NameSpaces in XSLT

You may come across a situation where you want to replace one set of namespaces to another set. A typical example is that you have a pass-through OSB Service whose proxy is based on your Project's namespaces and the underlying service is based on the out-of-the-box service namespaces.

In such cases, the following XSLT will search-replace the namespaces

For example, if your input xml looks like

<ns1:Response>
   <ns2:task>..</ns2:task>
   <ns2:address>..</ns2:address>
   <ns2:pin>..</ns2:pin>
   <ns3:address>
      <ns4:add1>..</ns4:add1>
      <ns4:add2>..</ns4:add2>
      <ns4:add3>
        <ns5:asdf>..</ns5:asdf>
        <ns5:qwe>..</ns5:qwe>
      </ns4:add3>
      <ns4:add4>..</ns4:add4>
    </ns3:address>
    <ns2:query>..</ns2:query>
</ns1:Response>

and the response has to have a different set of namespaces,

<myns1:Response>
   <myns2:task>..</myns2:task>
   <myns2:address>..</myns2:address>
   <myns2:pin>..</myns2:pin>
   <myns3:address>
      <myns4:add1>..</myns4:add1>
      <myns4:add2>..</myns4:add2>
      <myns4:add3>
        <myns5:asdf>..</myns5:asdf>
        <myns5:qwe>..</myns5:qwe>
      </myns4:add3>
      <myns4:add4>..</myns4:add4>
    </myns3:address>
    <myns2:query>..</myns2:query>
</myns1:Response>

The following XSLT works

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:myns1="http://www.w3.org/TR/html4/1"
xmlns:myns2="http://www.w3.org/TR/html4/2"
xmlns:myns3="http://www.w3.org/TR/html4/3"
xmlns:myns4="http://www.w3.org/TR/html4/4"
xmlns:myns5="http://www.w3schools.com/furniture"
xmlns:ns1="http://www.w3.org/TR/html4/1"
xmlns:ns2="http://www.w3.org/TR/html4/2"
xmlns:ns3="http://www.w3.org/TR/html4/3"
xmlns:ns4="http://www.w3.org/TR/html4/4"
xmlns:ns5="http://www.w3schools.com/furniture">

<xsl:template match="*">
  <myns1:taskListResponse>
    <xsl:apply-templates/>
  </myns1:taskListResponse>
</xsl:template>

<xsl:template match="ns2:*">
  <xsl:element name="myns2:{local-name()}">
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<xsl:template match="ns3:*">
  <xsl:element name="myns3:{local-name()}">
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

<xsl:template match="ns4:*">
  <xsl:element name="myns4:{local-name()}">
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>
<xsl:template match="ns5:*">
  <xsl:element name="myns5:{local-name()}">
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:copy/> </xsl:template>
</xsl:stylesheet>