Monday, November 26, 2012

more notes on java embedding

I noted in the past on BPEL java embedding

here are some additional notes:

1. importing syntax:

I'm using BPEL 2.0 this time. This is the importing syntax I'm using now, not sure if it's BPEL 2.0 thing. For sure it's different from my previous post:

add imports right above partner links and right below name spaces.

  <import location="oracle.xml.parser.v2.XMLElement" importType=""/>      
  <import location="" importType=""/>      

2. Two ways to get and set variables:

2.1. getting and setting string variables:
   nothing fancy, you can do straight:
    String foo = (String) getVariableData("foo");
    setVariableData("foo", "bar");

2.2. If you need to get to an Xpath in an element, then you have to do something like

XMLElement srcElem = (XMLElement) getVariableData("inputVariable", "payload", "/client:foo/client:bar");      
String bar = srcElem.getTextContent();      

remember you need to add "import" like in step 1. 

3. Gotcha's

Although it's very tempting, don't do this:
   String srcElem = (String) getVariableData("inputVariable", "payload", "/client:foo/client:bar");   
it doesn't work that way.

If you don't want to deal with the hassles of "importing" and casting, here is a recommended way to go around it. 
Using above example:
 a) create a BPEL string variable, call it "bar"
 b) inside BPEL, assign ("inputVariable", "payload", "/client:foo/client:bar") to the "bar" variable
 c) inside your java embedding, you can use get/set freely on "bar", just like in step 2.1 above.


  1. This comment has been removed by the author.

  2. Please find the enclosed attachmments for SCAC- 500012

    I've added the above mentioned Import statement still unable to resolve the issue.

    I've missed few things in the Forum to mention...

    [10:35:20 AM] Building...
    [10:35:28 AM] **** One or more compilation errors prevented deployment from continuing.
    [10:35:28 AM] **** Please correct all compilation errors before deploying.
    [10:35:28 AM] #### Deployment incomplete. ####
    [10:35:28 AM] **** One or more compilation errors prevented deployment from continuing. (oracle.adfdt.common.deploy.impl.AdfLibraryBuildDeployer)

    And from messages stack-log it is
    [10:37:17 AM] srikrishna G: Context: selection=Project_SK.jpr application=Application1.jws project=Project_SK.jpr node=Project_SK.jpr
    Compilation of project 'Project_SK.jpr' finished. Check 'C:\JDeveloper\mywork\Application1\Project_SK\SCA-INF\classes\scac.log' for details.
    ignoring C:\JDeveloper\mywork\Application1\Project_SK\testsuites\fileList.xml; not on source path
    ignoring C:\JDeveloper\mywork\Application1\Project_SK\BPELProcess1.wsdl; not on source path
    ignoring C:\JDeveloper\mywork\Application1\Project_SK\xsd\BPELProcess1.xsd; not on source path
    ignoring C:\JDeveloper\mywork\Application1\Project_SK\composite.xml; not on source path
    [10:35:28 AM] Compilation complete: 1 errors, 0 warnings.

    We are using J Developer version.
    Please let me know if i 've missed anything.