Search This Blog

Thursday, February 23, 2012

BPEL Process to display the IP Address of a hostname

 

Create a BPEL process with the following java embded code ,
<bpelx:exec import="java.net.*"/>
    <bpelx:exec name="Java_Embedding_1" language="java" version="1.3">
      <![CDATA[String ipaddr = (String)getVariableData("stringvar");   
System.out.println(ipaddr); 
try { 
        InetAddress addr1 = InetAddress.getByName(ipaddr); 
          byte[] ipAddr = addr1.getAddress(); 
          // Convert to dot representation 
          String ipAddrStr = ""; 
          for (int i=0; i<ipAddr.length; i++) { 
              if (i > 0) { 
                  ipAddrStr += "."; 
              } 
              ipAddrStr += ipAddr[i]&0xFF; 
          } 
      System.out.println(" Lookup Host Name " +addr1 +" --> " +ipAddrStr); 
      ipaddr = ipAddrStr;

catch(Exception e1) { 
e1.printStackTrace(); 
}
setVariableData("stringvar",ipaddr);]]>
    </bpelx:exec>
Please refer to the Java Doc for the API call's that you can use in BPEL java
http://docs.oracle.com/cd/B31017_01/integrate.1013/b28986/com/collaxa/cube/engine/ext/BaseBPELXExecLet.html
http://technology.amis.nl/blog/2387/embedding-java-in-bpel-process
http://niallcblogs.blogspot.in/2008/01/bpel-embedded-java.html

No comments: