Wednesday, April 13, 2016

ORABPEL-05250 Error - Few possible solutions

If you see the below error while deploying the SOA composite into the SOA11g server

Deploying on partition "default" of "/Farm_soa_prod/soa_prod/soa_server1" ...
Deploying on "/Farm_soa_prod/soa_prod/soa_server1" failed!
There was an error deploying the composite on soa_server1: Deployment Failed: Error occurred during deployment of component: GTM_CLM_Process_ScreeningResults to service engine: implementation.bpel for composite: GTM_CLM_Process_ScreeningResults: ORABPEL-05250

Error deploying BPEL suitcase.
error while attempting to deploy the BPEL component file "/netapp01/fmwprodbin/Oracle/Middleware/user_projects/domains/soa_prod/servers/soa_server1/dc/soa_dbc0254e-8aa1-4d20-9cef-457b9f5fa15c"; the exception reported is: java.lang.Exception: BPEL 1.1 compilation failed

This error contained an exception thrown by the underlying deployment module.
Verify the exception trace in the log (with logging level set to debug mode).

There might be few reasons, but look at the last changes you made and try to think.

Here are few what we have faced and found the resolutions. It may help you as well.

Resolution1:  This issue is coming while using the cloud service.  Need to find solution.   The reason is, one of the custom field is not available in the targeted (here OSC service for us) web service WSDL, so while compiling with configuration file it used to fail.


Resolution2:  Using Java Embedded Activity is causing the error with java classed used.  For example the Class name using directly as  InetAddress   without using the package name.  So the solution was to use the complete package name as  java.net.InetAddress;

Friday, April 1, 2016

How to get SOA host server DVM file path to refer dynamically from that SOA server MDS

When we develop a BPEL process, most of the time it will connect different external (target) systems.  Some times we need to use the DVMs for getting the values dynamically.  So we create a DVM in the SOA server and load the DVM values file into the MDS database.  Now the BPEL process has to use the SOA host dynamically to identify the DVM file path from the MDS.

So to identify the SOA server host name dynamically we can follow the below steps.


1. Create a DVM  TestDVM.dvm with two columns, OrganizationId, OrganizationIdValue.

TestDVM.dvm
=============
OrganizationId    |    OrganizationIdValue
---------------------------------------------------
host1                              abc123
host2                              def234

2. Create a string variable HostName in BPEL process
3. Inside the BPEL process use a Java Embedding activity and write the below code init.

                   String HostName = null;  
                    try{                                                                        
                          InetAddress addr = InetAddress.getLocalHost();  
                          HostName = addr.getHostName();  
                          addAuditTrailEntry("Host name is " + HostName);  
                          setVariableData("HostName",HostName);  
                    } catch (Exception ex) {                                                                  
                          ex.printStackTrace();  
                        addAuditTrailEntry(ex.getMessage());  
                    }

Now the value is available in the BPEL string variable.

4. If we need to use this value in the XSL files then pass the BPEL variable as input element to the XSL file.

Inside the XSL file use the DVM function to get the value.
dvm:lookupValue("TestDVM.dvm","OrganizationId",$HostName,"OrganizationIdValue",$HostName).


Tuesday, March 8, 2016

Calling HTTPS REST API from JAVA using HTTPClient and Jersey

Apache HTTP Client
==================
import java.io.File;

import java.net.URI;

import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;


public class JavaHttpsRestCall {
  public static void main(String[] args) throws Exception {
    //Optional if the certificate is in the right truststore
    String keystorePath = "lib/DevDemoTrust.jks";
    File keyStoreFile = new File(keystorePath);
    System.setProperty("javax.net.ssl.trustStore",    keyStoreFile.getAbsolutePath());

    CredentialsProvider provider = new BasicCredentialsProvider();
    UsernamePasswordCredentials credentials =   new UsernamePasswordCredentials("khaleel", "pwd123");
 
    CloseableHttpClient httpclient = HttpClients.createDefault();
 
    try {
          URI uri =  new URIBuilder().setScheme("https").setHost("devlattice.bigmachines.com")
              .setPath("/rest/v1/commerceDocumentsOraclecpqoTransaction")
              .setParameter("q","{'lastPricedDate_t': {$gt: '2015-10-27T12:30:00'}}")
              .setParameter("expand","transactionLine")
              .setParameter("limit","5")
              .setParameter("offset","0")
              .setParameter("totalResults","true").build();
     
        HttpGet httpget = new HttpGet(uri);
          httpget.addHeader(new BasicScheme().authenticate(credentials, httpget, null));
          //httpget.addHeader("accept", "application/json");
          //httpget.addHeader("Content-Type", "application/json");
     
      System.out.println("Executing request " + httpget.getRequestLine());
      CloseableHttpResponse response = httpclient.execute(httpget);
      try {
        System.out.println("----------------------------------------");
        System.out.println(response.getStatusLine());
        System.out.println(EntityUtils.toString(response.getEntity()));
        System.out.println("----------------------------------------");
      } finally {
        response.close();
      }
    } finally {
      httpclient.close();
    }

  }
}

Apache Jersey
=================
import sun.misc.BASE64Encoder;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import org.apache.http.client.utils.URIBuilder;

import java.io.File;

import java.net.URI;

import org.apache.http.client.utils.URIBuilder;

public class JerseyClient {

  public static void main(String[] a) throws Exception {

    String keystorePath = "lib/DevDemoTrust.jks";
    File keyStoreFile = new File(keystorePath);
    System.setProperty("javax.net.ssl.trustStore",
                       keyStoreFile.getAbsolutePath());
   
    String url =     "https://devkk.bigmachines.com/rest/v1/commerceDocumentsOraclecpqoTransaction?expand=transactionLine&q=%7B+%27lastPricedDate_t%27%3A+%7B%24gt%3A+%272015-10-27T12%3A30%3A00%27%7D%7D&limit=10&offset=0&totalResults=true";

    URI uri =  new URIBuilder().setScheme("https").setHost("devlattice.bigmachines.com")
      .setPath("/rest/v1/commerceDocumentsOraclecpqoTransaction")
      .setParameter("q","{'lastPricedDate_t': {$gt: '2015-10-27T12:30:00'}}")
      .setParameter("expand","transactionLine")
      .setParameter("limit","100")
      .setParameter("offset","0")
      .setParameter("totalResults","true").build();

    String name = "kshaik";
    String password = "pwd123";
    String authString = name + ":" + password;
    String authStringEnc = new BASE64Encoder().encode(authString.getBytes());
    System.out.println("Base64 encoded auth string: " + authStringEnc);
    Client restClient = Client.create();
    WebResource webResource = restClient.resource(url);
    ClientResponse resp =
      webResource.accept("application/json").header("Authorization",
                                                    "Basic " + authStringEnc).get(ClientResponse.class);
    if (resp.getStatus() != 200) {
      System.err.println("Unable to connect to the server");
    }
    String output = resp.getEntity(String.class);
    System.out.println("response: " + output);
  }
}


Wednesday, August 26, 2015

Android studio start up issue with tools.jar not found

Error while starting Android Studio on windows with tools.jar not found

Error Message:
'tools.jar' seems to be not in Android Studio classpath.  
Please ensure JAVA_HOME points to JDK rather than JRE.

Solution:
Edit the  AndroidStudio\bin\idea.properties  file
Modify the  value of idea.dynamic.classpath  from flase to true.

So the property value should be as shown below.

idea.dynamic.classpath=true  


Note:  JAVA_HOME should be properly set.
Ex:
JAVA_HOME in System Variables  
E:\Program Files\Java\jdk1.8.0_25

Tuesday, June 2, 2015

Simple way of understanding IoC and DI

Most of the time it's difficult to distinguish between Inversion Of Control (IoC) and Dependency Injection (DI).  Because they both have inter linked and overlaps with each other.

I will try to put it for you to understand easily and draw a thin line between them.

IoC is the way of  inverting (giving) the control to external entity to create the required object on-demand. Where as the DI is a process of creating and injecting the required objects on-demand to support the IoC.

That means IoC uses DI.   DI can be implemented using setter methods, constructors, etc.

Comments are most welcome...

Monday, September 29, 2014

Example for subtracting time using xp20:subtract-dayTimeDuration-from-dateTime


We can use the  xp20:subtract-dayTimeDuration-from-dateTime(String1, String2) function to subtract  duration of String2 from String1 time.

For example:
         To subtract one day
              xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'P1D')

         To subtract  2 hours from the current date time 
             xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'PT2H')

        To subtract  one day 2 hours 
             xp20:subtract-dayTimeDuration-from-dateTime(xp20:current-date(), 'PD1DT2H')


The following example query adds a dayTimeDuration value equal to 1 day, 2 hours, 30 minutes, and 5 seconds to a date Time value equal to the date: January 1, 2003 and time: 1:00 AM as shown in the following query:
{
op:add-dayTimeDuration-to-dateTime(xs:dateTime("2003-01-01T01:00:00"), xf:dayTimeDuration("P1DT2H30M5S"))
}
The resulting date Time value equal to the date: January 2, 2003 and the time: 3:30:05 AM is returned as shown in the following result:
2003-01-02T03:30:05

Note:  The key observation here is that the format of String2,  if you don't have the time to be subtracted then just use  P, if you have time to be subtracted then user PT at the beginning.


Saturday, April 12, 2014

Is API Management = EPI

My boss asked me a question, "Is API Management going to rule over SOA?".  I had browsed through several sites and try to find out the details of API Management.  As usual, with the work API can't distinguish much.  Finally I made a list of comparisons and use cases to explain both of them (API Management and SOA) are not really rivals.   Both exist always and adds value at different levels to the organizations.

Now I have found a blog in SOA Thinkar  preferring "Enterprise API Management" in short EPM.  Its straight went into my mind not to confuse with popular API understanding.

I feel easy to understand and distinguish the modern API Management concept by calling them "Enterprise Programming Interface" in short EPM.

So I say  API Management = EPI.

Your thoughts are always welcome....