Powered By Blogger

Search This Blog

Tuesday, April 5, 2011

Java Embedding

“I have a Customer Entity Bean that allows me to retrieve a SSN based on an email id. How can I invoke that bean from within my BPEL process?”


There are 3 solutions to this problem: • Wrapping the Java component into a full blown web service using JDeveloper or Axis • Using the WSIF Java Binding • Using the Java BPEL exec extension ()


1. BPEL Extension which allows developers to embed a snippet of Java code within a BPEL process 2. When the is reached, the server executes the snippet of Java code (within its JTA transaction context) 3. A set of built-in methods allow developers to read and update scope variables, instance metadata and audit trail 4. XML Façade can be used to simplify DOM manipulation 5. Java exceptions are converted into BPEL faults and bubbled into BPEL process 6. The snippet can propagate its JTA transaction to session and entity beans that it calls


----------------------------------------------------------------------------


BPEL Concepts Built-in Methods Java Embedding Object lookup( String name ) Locator getLocator( ) long getInstanceId( ) String setTitle( String title ) / String getTitle() String setStatus( String status ) / String getStatus() void setIndex( int i, String value ) / String getIndex( int i ) void setPriority( int priority ) / int getPriority() void setCreator( String creator ) / String getCreator() void setCustomKey( String customKey ) / String getCustomKey() void setMetadata( String metadata ) / String getMetadata () String getPreference( String key ) void addAuditTrailEntry(String message, Object detail) void addAuditTrailEntry(Throwable t) File getContentFile( String rPath ) Object getVariableData(String name) throws BPELFault Object getVariableData(String name, String partOrQuery) throws BPELFault Object getVariableData(String name, String part, String query) void setVariableData(String name, Object value) void setVariableData(String name, String part, Object value) void setVariableData(String name, String part, String query, Object value)


What Did We Learn? • There are 3 ways to integrate an existing Java component into a BPEL process: 1) wrapping that component in a SOAP service, 2) using a binding framework such as WSIF or 3) inline a code snippet using • The snippet is executed within the transaction context of the BPEL server. You can propagate that transaction to your own session and entity beans • A set of built-in methods allow the snippet to read and update variables, change instance metadata and throw faults • XML Façade can be used within a snippet to simplify DOM manipulation




No comments: