2 Replies Latest reply: Apr 18, 2012 1:47 PM by 931590 RSS

    Calling business event (invoke webservice) from OAF

    931590
      I have a scenario where I need to invoke a webservice from OAF page. I have created a business event and subscription. In the ApplicationModule of my OAF page I have the following code:
      // invoker business event
      String eventName = "xxftc.temp.oracle.try";
      // unique key for the web service invocation
      String eventKey = "key1";
      // event data - XML payload sent to web service as input
      String evtData = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
      " <SOAP-ENV:Header/>\n" +
      " <SOAP-ENV:Body>\n" +
      " <ProcessOutboundROShipmentRequest xmlns=\".............\">\n" +
      " <deliveryId>24009</deliveryId>\n" +
      " <printServer>127.0.0.1</printServer>\n" +
      " <printQueue>ZPL</printQueue>\n" +
      " </ProcessOutboundROShipmentRequest>\n" +
      " </SOAP-ENV:Body>\n" +
      "</SOAP-ENV:Envelope>\n";
      Connection conn = ((OADBTransactionImpl)getOADBTransaction()).getJdbcConnection();
      BusinessEvent event = null;
      try{
      event = new BusinessEvent(eventName, eventKey);
      event.setData(evtData);
      event.raise(conn);
      }
      catch (BusinessEventException e) {
      throw new OAException("Exception occured when invoking web service - "+e.getMessage());
      } finally {
      getOADBTransaction().commit();
      }

      Once I execute this code I get the following error:
      Error


      Exception occured when invoking web service - Unexpected Exception in Subscription java://oracle.apps.fnd.wf.bes.WebServiceInvokerSubscription -> java.lang.ExceptionInInitializerError


      What could be the root cause of this issue and how can this be fixed?

      When I test the same in Business Event tester I get different error:

      Error
      Exception occured in Java Raise - Exception when Invoking Web Service -> oracle.apps.fnd.wf.bes.InvokerException: javax.xml.rpc.soap.SOAPFaultException: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}

      Edited by: 928587 on Apr 18, 2012 11:19 AM
        • 1. Re: Calling business event (invoke webservice) from OAF
          Vijay Shanmugam
          Business event does not require you to pass the complete SOAP envelope. If you had to do that you could directly use OraSAAJ to invoke the service, Business event is not needed.

          All you have to pass is the Web Service's input payload

          <ProcessOutboundROShipmentRequest xmlns=\".............\">\n" +
          " <deliveryId>24009</deliveryId>\n" +
          " <printServer>127.0.0.1</printServer>\n" +
          " <printQueue>ZPL</printQueue>\n" +
          " </ProcessOutboundROShipmentRequest>

          As far error java.lang.ExceptionInInitializerError, it could occur if you invoke it from JDeveloper directly due to classloader misconfiguration for the embedded OC4J to load WSIF libraries. You may have to first test the web service invocation using a simple Java class main method and then use it from OAF page. As far testing the OAF page you would have to do it from EBS instance's OC4J.

          You are encouraged to read chapter "Working With Oracle Workflow Business Event System to Invoke Web Services" from Integrated SOA Gateway Developer Guide at http://docs.oracle.com/cd/E18727_01/doc.121/e12065/T511473T516922.htm

          Hope this helps.
          • 2. Re: Calling business event (invoke webservice) from OAF
            931590
            Thank you Vijay.

            I had already tried without the soap envelope. Still had the same issue. Will try to read the doc.

            Also my testing through the Business Event tester from Workflow Administrator->Business Events-> Business Event: Events.Test also failed with following error:

            Error
            Exception occured in Java Raise - Exception when Invoking Web Service -> oracle.apps.fnd.wf.bes.InvokerException: javax.xml.rpc.soap.SOAPFaultException: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}