How to call a Asynchronous bpel process from a PLSQL procedure?

How to call a Asynchronous bpel process from a PLSQL procedure?

Hi,
You could do something smart and technical very spiffy with soap-stacks in the database and/or dbms_ws/dbms_http. But I allways find AQ with AQ-adapter the simplest. Let Pl/sql enqueue a message on an aq-queue and subscribe an aq-adapter process on it. That can call your async-bpel process. If you want to get answer back in pl/sql, let the aq-adapter process enqueue a response message on another queue or on the same queue with another consumer name. Give it a correlation-id that you provided in the payload of your request message. Your pl/sql process can then do a dequeue on that correlation-id. It will sit and wait until a message with that correlation id is enqueued on the queue.
Regards,
Martien

Similar Messages

  • Invoking asynchronous BPEL process from java ui

    Hi,
    I am invoking an asynchronous BPEL process from java ui.
    I read somewhere that i can obtain an instance handler uing the lookupInstance() method of class Locator using the conversation id provided by the class NormalizedMessage.
    My code looks like this
    // Connect to Oracle BPEL server
    Locator locator = new Locator("default","bpel");
    IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
    // Construct a normalized message and send to Oracle BPEL Process Manager
    NormalizedMessage nm = new NormalizedMessage();
    nm.addPart("payload", xml);
    // Initiate the BPEL process
    deliveryService.post("MyLoanFlow", "initiate", nm);
    //Obtain the instance handler
    IInstanceHandle handle = locator.lookupInstance(NormalizedMessage.CONVERSATION_ID);
    But this is giving the error - can not find any instance with conversation id 'conversationId'.
    Also, if i try to obtain a list of instance handles associated with a process , it does not contain the most recently created instance
    IBPELProcessHandle ph = locator.lookupProcess("MyLoanFlow");
    IInstanceHandle[] iHandler = ph.listInstances();
    out.println(iHandler.length + "<br>");
    if i invoke the process for the first time the output is 0.
    can you please help me. it is urgent.

    Hi Sudipto,
    Regarding your second question,
    deliveryService.post("MyLoanFlow", "initiate", nm);
    IBPELProcessHandle ph = locator.lookupProcess("MyLoanFlow");
    IInstanceHandle[] iHandler = ph.listInstances();
    out.println(iHandler.length + "<br>");
    ---- returns 0 ---
    This is because MyLoanFlow is an asynchronous process in your case. So the control is returned to your java block immediately after the request for a new instance is posted. And your second line of code(querying for the list of instances) is executed even before the instance is created on the server side. You can verify this in two ways:
    1. try creating an instance of a synchronous process using IDeliveryService.request - this will always result in the increment since the current thread is blocked till the new instance is created.
    2. for your case, you can try
    Thread.currentThread().sleep(500); - just allow the server some time for completing the instance before you query it for the list of instances..
    and wrt question 1,
    //Obtain the instance handler
    IInstanceHandle handle = locator.lookupInstance(NormalizedMessage.CONVERSATION_ID);
    But this is giving the error - can not find any instance with conversation id 'conversationId'.
    For setting the conversationId, you could do so by including the following inside your .bpel file
    <bpelx:exec name="test-setConversationId" language="java" version="1.4">
    <![CDATA[
    setConversationId("conversationId");
    ]]>
    </bpelx:exec>
    The code:
    IInstanceHandle ins = locator.lookupInstanceByConversationId(NormalizedMessage.CONVERSATION_ID);
    should fetch you the required instance in this case.
    HTH,
    Anuj

  • Calling OWSM Secured BPEL Process from JAVA

    HI,
    I have created OWSM gateway and registered BPEL process under that.
    Now i want to call that BPEL process from java class. Can anybody please tell me how can i pass the security SOAP header.
    Here is the class i am using ...
    package com.javarpc;
    import java.rmi.RemoteException;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.JAXRPCException;
    import javax.xml.rpc.Service;
    import javax.xml.rpc.ServiceException;
    import javax.xml.rpc.ServiceFactory;
    import javax.xml.rpc.ParameterMode;
    import javax.xml.rpc.encoding.XMLType;
    import javax.xml.rpc.soap.SOAPFaultException;
    import org.apache.axis.client.Call;
    import org.apache.axis.message.SOAPBodyElement;
    import java.io.InputStream;
    import java.io.ByteArrayInputStream;
    public class CallHelloWorld
    private static QName SERVICE_NAME;
    private static QName PORT_TYPE;
    private static QName OPERATION_NAME_IN;
    private static String SOAP_ACTION;
    private static String STYLE;
    private static String THIS_NAMESPACE = "http://xmlns.oracle.com/HelloWorld";
    private static String PARAMETER_NAMESPACE = "http://xmlns.oracle.com/HelloWorld";
    private String location;
    static
    SERVICE_NAME = new QName(THIS_NAMESPACE,"HelloWorld");
    PORT_TYPE = new QName(THIS_NAMESPACE,"HelloWorld") ;
    SOAP_ACTION = "process";
    /*Setting for Wraped style of calling*/
    //STYLE = "wraped";
    //OPERATION_NAME_IN = new QName(THIS_NAMESPACE,"HelloWorldProcessRequest");
    /*Setting for Message style of calling*/
    STYLE = "message";
    OPERATION_NAME_IN = new QName(THIS_NAMESPACE,"process");
    public void setLocation(String location)
    this.location = location;
    public void initiate(String symbol)
    try
    /* Create Service and Call object */
    ServiceFactory serviceFactory = ServiceFactory.newInstance();
    Service service = serviceFactory.createService( SERVICE_NAME );
    Call call = (Call)service.createCall( PORT_TYPE );
    /* Set all of the stuff that would normally come from WSDL */
    call.setTargetEndpointAddress( location );
    call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
    call.setProperty(Call.SOAPACTION_URI_PROPERTY, SOAP_ACTION);
    call.setProperty( Call.OPERATION_STYLE_PROPERTY , STYLE );
    call.setOperationName(OPERATION_NAME_IN);
    /*Setting Input for message type and invoke web service through message style*/
    String strXMLInput="<HelloWorldProcessRequest xmlns=\"http://xmlns.oracle.com/HelloWorld\">";
    strXMLInput+="<enovia>test</enovia>";
    strXMLInput+="</HelloWorldProcessRequest>";
    SOAPBodyElement[] requestSBElts = new SOAPBodyElement[1];
    InputStream resultInputStream = new ByteArrayInputStream(strXMLInput.getBytes());
    requestSBElts[0] = new SOAPBodyElement(resultInputStream);
    System.out.println(requestSBElts[0]);
    java.util.Vector output = (java.util.Vector) call.invoke(requestSBElts);
    System.out.println( "HelloWorld BPEL process initiated by message " +output);
    /*Setting Input for message type and invoke web service through wraped style
    call.addParameter(new QName(PARAMETER_NAMESPACE,"input"), XMLType.XSD_STRING, ParameterMode.IN);
    //call.setReturnType(new QName("XMLType.XSD_STRING"));
    // call.setReturnType(new QName("String"));
    Object[] params = new Object[1];
    String outPut = new String();
    params[0] = symbol;
    call.invokeOneWay(params);
    //Object ret;
    //ret = (String) call.invoke( params );
    System.out.println( "HelloWorld BPEL process initiated" );*/
    catch (SOAPFaultException e)
    System.err.println("Generated fault: ");
    System.out.println (" Fault Code = " + e.getFaultCode());
    System.out.println (" Fault String = " + e.getFaultString());
    catch (JAXRPCException e)
    System.err.println("JAXRPC Exception: " + e.getMessage());
    catch (ServiceException e)
    System.err.println("Service Exception: " + e.getMessage());
    catch (RemoteException e)
    System.err.println("RemoteException: " + e.getMessage());
    public static void main(String[] args)
    String symbol = "Kevin";
    // String location = "http://valizprd208.val.cummins.com:7777/orabpel/tst/HelloWorld/1.0";
    String location = "http://integrationvaldlv.cummins.com:7777/gateway/services/SID0003002?wsdl";
    CallHelloWorld client = new CallHelloWorld();
    client.setLocation( location );
    client.initiate( symbol );
    }

    You can get sample input by intercepting the request to check what exactly you need to put in SOAP header and what in body.
    To manipulate soap header you can look at : http://www.oracle.com/technology/sample_code/tech/java/codesnippet/webservices/soapheader/index.html
    HTH
    Chintan

  • Can we invoke a asynchronous BPEL process from synchronous and vice versa

    Hi,
    Can we invoke a BPEL asynchronous process from synchronous and vice versa. If so how to perform that.
    thanks,
    Vijay

    Yes you can
    sync -- calling --> Asyncc
    Async -- calling --> syncc
    Perfomance is no issue, depending on your requirements. Not the Syncprocesses are short-running processes, these will time-out after 30 seconds, if no answer is coming from the async process.
    Marc
    http://orasoa.blogspot.com

  • How to call EJB deployed on OC4J from java stored procedure?

    Hello,
    I'd like to call EJB from java stored procedure. My example works fine from command line, but the problem seems to be with deployment of this code into database. Especialy I'm wondering how to reference jars like oc4jclient.jar, ejb.jar, ... from java stored procedure.
    Is there some example how to do that ?
    Can You help me please ?
    Many thanks,
    Radim Kolek,
    Eurotel Prague.

    Hi,
    You may want to check up this thread
    Calling JBoss EJBs from Java stored procedure
    Hope this helps,
    Sujatha.
    OTN Group.

  • How can I run an external program from a PLSQL procedure?

    Is there a package to run an external program from PLSQL? or is there another way to do that?
    thanks.

    here there is an example about how a PL/SQL procedure can
    work with an external C program.
    http://download-east.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76936/dbms_pi2.htm#1003384
    Apart from that you have Java Stored Procedures option
    to carry out your task.
    Java Stored Procedures Developer's Guide Contents / Search / Index / PDF
    http://download-east.oracle.com/docs/cd/B10501_01/java.920/a96659.pdf
    Joel P�rez

  • Question: How to call a BPEL process from a PL/SQL procedure

    Hi All,
    Greetings to all BPEL people. I have a question on how can we call a BPEL process from a PLSQL procedure. It might be a stupid question but i wanted to know whether this fetaure is available in BPEL as our scenario requires us to explore if this functionality is available in BPEL.
    Please let me know and also if possible please send me the links for the tutorials if it is available.
    Thanks In Advance,
    Dibya

    Yes u can do it. there are two ways.
    1) First one is using utl_http package of PL/SQL
    In this case u can create SOAP request message & send it as Http request to your deployed BPEL process.
    This package provides some methods like
    set_header,write_text,get_response,read_text etc..
    Following is part of code which may be helpful to you.
    create or replace package body test_book_order_sub_pkg
    is
    FUNCTION test_book_order_sub(p_subscription_guid IN RAW,
    p_event IN OUT WF_EVENT_T
                                            Return VARCHAR2 IS
    soap_request varchar2(30000);
    soap_respond varchar2(30000);
    http_req utl_http.req;
    http_resp utl_http.resp;
    launch_url varchar2(240) ;
         begin
         DBMS_OUTPUT.Put_Line('Subscription : Order has been booked');
         soap_request:='<?xml version="1.0" encoding="UTF-8"?>
         <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header/>
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/BES_BookOrder">
    <ns1:BES_BookOrderProcessRequest>
    <ns1:input>725</ns1:input>
    </ns1:BES_BookOrderProcessRequest>
    </soap:Body>
    </soap:Envelope>';
    http_req:= utl_http.begin_request
    ('http://172.28.5.191:8888/orabpel/default/BES_BookOrder/1.0',
    'POST',
    'HTTP/1.1'
    utl_http.set_header(http_req, 'Content-Type', 'text/xml') ;
    utl_http.set_header(http_req, 'Content-Length', length(soap_request)) ;
    utl_http.set_header(http_req, 'SOAPAction', 'initiate');
         utl_http.write_text(http_req, soap_request) ;
    http_resp:= utl_http.get_response(http_req) ;
    utl_http.read_text(http_resp, soap_respond) ;
    utl_http.end_response(http_resp) ;
    DBMS_OUTPUT.Put_Line(soap_respond);
    return('SUCCESS');
    end test_book_order_sub;
    end test_book_order_sub_pkg;
    2) Second way is make your BPEL process listening to some database Queue(use AQ Adapter). & then put some message in tht queue from ur Pl/SQL code . This will also initiate BPEL instance. Check out AQAdapter tutorials.
    /mishit

  • Unable to get callback from Asynchronous BPEL process to work (AXIS Client)

    Hello,
    I am calling an Asynchronous BPEL process from an AXIS client, and I am unable to get the callback functionality to work. The AXIS client code has been generated from WSDL2Java using the BPEL process' WSDL file.
    I CAN insert an invoke node in the BPEL process and invoke my Callback web service using that, but obviously that means the BPEL process is limited to only responding to one pre-determined client, which won't work.
    My questions:
    - How does the BPEL process know what endpoint to use to make the callback?
    - Do I need to modify the generated code to create a SOAP Envelope and invoke the process with the envelope, intead of the invokeOneWay call?
    - If I do need to create a SOAP Envelope with a replyto element, what is the structure of a typical BPEL envelope? Is there an example somewhere?
    I have looked at the examples in the interop directory, specifically the AXIS calling Async BPEL, but I would like to try to keep the client code as independent as possible (I don't really want to have a dependency on the OTN library).
    Any help would be greatly appreciated!!
    Thank you.
    -Ryan

    Please have a look at the Binding in the WSDL. Axis must provide the ReplyTo and
    MessageId information there. As far as I see, this must be done by an Axis-Handler,
    because the Binding-Part in not generated by WSDL2Java.
    I was able to generate the JavaClasses by using the "WSDL2Java -a" option, but
    I still do not see how to use them in a handler and how to register the handler.
    Maybe someone can give me a hint.

  • Asynchronous BPEL Process called from an empty BPEL process getting lost.

    Hi
    I have an empty BPEL process calling an asynchronous BPEL process. The empty process is triggered by a read file activity. It finishes successfully and even calls the asynchronous process. There is no error thrown but the called asynchronous process does not show up in the dashboard.
    When this asynchronous process is manually run from the console I get the page stating 'Cannot find the specified instance'.
    I am using Jdev 10.1.3.2 and SOA Suit 10.1.3.1.
    Any suggestion as to why this is happening and what is the remedy?
    Buddhadev.

    Check your log as soon as you find that the parent process has found its way into the console. More information on logging can be found here - http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28982/logging.htm
    Not quite sure why its so, but since 10.1.3, I've observed that the console simply doesn't show errored processes at times. So, checking the log can be a starting point in diagnosing the real issue.
    HTH
    Antony

  • Clarification needed in calling synchronous bpel process from plsql

    Hello all,
    I am trying to a bpel from the plsql function as given in the folowing link:
    http://orasoa.blogspot.com/2006/10/calling-bpel-process-from-raw-plsql.html
    I have a doubt that, what is: p_DefaultDetail ?
    and what is XMLTRANSFORM method here is used for?
    I am getting an error that XMLTRANSFORM is not detected.
    can any one provide some pointers to get it resolved.
    Thanks
    Krrish

    If you install the database you also have the option to install optional components. One of these is the xmldb (or some support for it in the database , dunno how to call it).
    So i guess you need to install this extra component and you're there (assuming Marc his reply on the question where to find the xmltransform function is correct :))

  • Calling a BPEL process from java (STRUTS)

    Hi,
    I´ve a workspace where I have all the deployed bpel processes, and I´ve other workspace with a Struts project. I deployed my Struts project in the OC4J Server where the BPEL processes are deployed.
    I´m trying to initialise Locator instance in a .java file. The Locator will search the bpel processes in the default domain. I get an exception when I run the project, dont know what I´m doing wrong. (can´t copy the exception from the Embedded OC4J Server)
    THE CODE:
    static Locator locator = null;
    static String bpelDomain = "default";
    static String bpelDomainPassword = "bpel";
    static String orabpelPlatform = "oc4j_10g";
    static String javaNamingFactoryInitial = "com.evermind.server.rmi.RMIInitialContextFactory";
    static String javaNamingProviderUrl = "ormi://develc15:23791/orabpel";
    static String javaNamingSecurityPrincipal = "admin";
    static String javaNamingSecurityCredentials = "welcome";
    static String dedicatedRmiContext = "true";
    public static void invokeProcess(String processName, String operationName, String sXml)
    try
    Properties props = new java.util.Properties();
    props.setProperty("orabpel.platform",orabpelPlatform);
    props.setProperty("java.naming.factory.initial",javaNamingFactoryInitial);
    props.setProperty("java.naming.provider.url",javaNamingProviderUrl);
    props.setProperty("java.naming.security.principal",javaNamingSecurityPrincipal);
    props.setProperty("java.naming.security.credentials",javaNamingSecurityCredentials);
    props.setProperty("dedicated.rmicontext", dedicatedRmiContext);
    locator = new Locator(bpelDomain, bpelDomainPassword,props);
    } catch (Exception r)
    r.printStackTrace();

    I tried to call an async BPEL process from simple Java client. The only difference that I see in your code and mine is, that I haven't specified the "orabpelPlatform" and "dedicatedRMIContext" properties. Also, another diferenece is the ProviderURL used. I have copied the settings as found under "samples/tutorial/102.InvokeProcess/rmi/Context.Properties".
    While setting the properties use -
    Context.INITIAL_FACTORY
    Context.PROVIDER_URL
    Context.SECURITY_PRINCIPAL
    Context.SECURITY_CREDENTIALS
    instead of specifying java.naming.xxxxxx class names.
    Please check the file to see what are the Context properties set during installation for your BPEL PM. Use the same to define Properties to be passed as parameter in the Locator constructor.
    ~ Amit

  • Can an synchronous ESB process initiate an asynchronous BPEL process?

    I have a requirement to create a synchronous ESB service that initiates an aysnchronous BPEL process returning a success message to the requesting system.
    I can create an esb that receives a paylaod from the requesting system and returns a receipt message, I then created an asynchronous bpel process.
    Although I can initiate the asynchronous bpel process from the ESB I cannot work out how to send back the success message? The routing rules do not allow setting of outgoing messages unless you call a synchronous process?

    Can you make the BPEL process synchronous. Calling a asynchronous process breaks your synchronous message, because what happens if your asynchronous process takes longer that 1 minute. The synchronous process will timeout but the asynchronous process will complete.
    The previous note is correct you can use queues but all this will do is tell you that you posted correctly, you get the same result calling a web service. Asynchronous is fire and forget in a ESB world as it is stateless.
    cheers
    James

  • Error while invoking an asynchronous BPEL process

    Hi ,
    I am trying to call an asynchronous BPEL process through java client.
    Following is the code which I got from SOA bpel samples present in the following location
    <SOA_HOME>\bpel\samples\tutorials\102.InvokingProcesses\rmi\com\otn\samples\async
    The code fails while registering the callback
    String convId = GUIDGenerator.generateGUID();
    nm.setProperty(NormalizedMessage.CONVERSATION_ID, convId);
    deliveryService.post("HelloWorld", "initiate", nm);
    // register the callback
    watchdog.registerAsyncCallback(convId, testAsyncHandler,
    locator.getDomainAuth());
    The error says java.lang.NoClassDefFoundError: org/collaxa/thirdparty/json/JSONString
    I tried to search for this in google. But it seems noone has got this error or maybe noone has used this at all.
    Maybe I am missing some jar file, but I am unable locate that.
    Can someone help me in this please.

    Hi,
    These sort of class not found errors come when you are running from a client which does not have all the jar files requried to invoke BPEL using the client API.
    org/collaxa/thirdparty/json/JSONString is orabpel-thirdparty.jar.
    The complete list of Jar files you would need in the classpath are:
    ejb.jar ($ORACLE_HOME/home/lib)
    oc4j-internal.jar ($ORACLE_HOME/home/lib)
    optic.jar ($ORACLE_HOME/opmn/lib)
    orabpel-common.jar ($ORACLE_HOME/bpel/lib)
    orabpel-thirdparty.jar ($ORACLE_HOME/bpel/lib)
    orabpel.jar ($ORACLE_HOME/bpel/lib)
    Hope this helps,
    Regards,
    Shanmu.
    http://www.prshanmu.com/articles/

  • OSB -- Invoking an asynchronous BPEL process in Oracle Service Bus

    Hi All,
    Can any one let me know how to invoke the Asynchronous BPEL process in OSB.
    Thanks in Advance,
    Feroz Tasha.

    Hey,
    What i was trying to say was that when you export your OSB project to file system, you can edit the business service in a file editor(e.g notepad, editplus etc).
    In that, instead of suppose 127.0.0.1 u can put a token say @@HOST_NAME@@ and for a port say 7001 as @@PORT_NUMBER@@.
    Then an ant script can replace the values of above 2 tokens with apt values, create a jar out of it and deploy it on the server.
    There are numerous ANT scripts and examples available online.
    Hope this helps.

  • Remote SAP function call from a plsql procedure

    Hi,
    How i can call a remote SAP function from a plsql procedure?
    Thnaks in advance:
    Bianca

    I don't see any relation to Oracle Forms in this question. Is there any? If so, can you specify what you want to do, and the version numbers of Forms and databases involved?
    And what does a call to a remote SAP procedure look like? Is it a DB procedure in an Oracle database? Then you can simply use a database link to the SAP database.

Maybe you are looking for

  • Screen is broken...still under warranty?

    my screen cracked and i asked the tech guys about it. they said that they can repair it free of charge. so i click on the link they give me and it says i have to purchase their service. how to i get them to repair it for free? and it is still under w

  • Java.beans.Expression and inner classes

    hello, test.java public class test public class in public in() System.out.println("inner"); t.java import java.beans.*; class t public static void main(String...args) try {       new Expression(test.in.class,"new",null).getValue ();                  

  • Problem with slideshows

    I can't view my albums as slide shows. When I click on the slide show button nothing happens. I've never had this problem before. Why is this happening?

  • Help with existNode function

    I am using the existNode function to check whether a specific node exists or has a value for it in the XML. So, am using it within an IF condition as below; IF L_xml.existSNode('/ItemFamily/Style/Item/Attributes/ItemAttributes/ExtRefNo/text()') > 0 T

  • Slow wifi mac mini

    Until yesterday mac mini wifi used to work fine. Ping works OK, it is only when a browser is used that the page does not load. TraceRoute shows only first 2 entries and then after a long pause it bursts out upto 8 entries and then it prints Three sta