WebServiceInvokerSubscription

The WebServiceInvokerSubscription class is a standard Java rule function that implements the SubscriptionInterface Java interface. This class invokes a business process execution language (BPEL) process or other Web service using the JAX-WS (Java API for XML-based Web Services) Dispatch from Oracle WebLogic Server.

The WebServiceInvokerSubscription class is stored in the oracle.apps.fnd.wf.bes Java package. The following list shows the APIs in this class.

Important: Java is case-sensitive and all Java method names begin with a lower case letter to follow Java naming conventions.

You can add custom processing if necessary by extending this class and overriding the preInvokeService, setInputParts, addWSSecurityHeader, addCustomSOAPHeaders, and postInvokeService methods.

onBusinessEvent

The WebServiceInvokerSubscription class defines the onBusinessEvent method from the SubscriptionInterface Java interface to invoke a Web service.

Java Syntax

public void onBusinessEvent
  (Subscription eo, 
   BusinessEvent event, 
   WorkflowContext context) throws BusinessEventException

Description

Performs the subscription processing to invoke a Web service when the triggering event occurs by calling the preInvokeService, invokeService, and postInvokeService methods. The subscription parameters must provide the Web Services Description Language (WSDL) description URL, service name, port type, operation, and port for the Web service.

If the execution of the subscription processing does not succeed, this method throws a BusinessEventException to pass the error details to the Event Manager.

Arguments (input)

eo The Subscription object, which provides information about the subscription such as the phase number and parameters.
event The BusinessEvent object, which provides information about the business event that occurred, including the event name, event key, event data, and payload object.
context Workflow context information, including the database connection and the Log object which can be used for logging.

preInvokeService

The WebServiceInvokerSubscription class always calls the preInvokeService method before invoking the Web service.

Java Syntax

protected String preInvokeService
  (Subscription eo, 
   BusinessEvent event, 
   WorkflowContext context) throws BusinessEventException

Description

Returns the string, usually in XML format, that will be used as the Web service request. The default implementation of this method checks whether an XSL file is specified in the WFBES_IN_XSL_FILENAME parameter for the subscription or the triggering event, and if so uses that XSL file to transform the event data to the format required for the Web service. Otherwise, the method simply returns the event data stored within the event message.

Note: If both the event and the subscription include the WFBES_IN_XSL_FILENAME parameter, then the event parameter value overrides the subscription parameter value.

If you extend the WebServiceInvokerSubscription class, you can override this method to add further processing before the Web service is invoked.

If the pre-invocation processing does not succeed, this method throws a BusinessEventException.

Arguments (input)

eo The Subscription object, which provides information about the subscription such as the phase number and parameters.
event The BusinessEvent object, which provides information about the business event that occurred, including the event name, event key, event data, and payload object.
context Workflow context information, including the database connection and the Log object which can be used for logging.

setInputParts

The setInputParts method is called during the invocation processing.

Java Syntax

protected void setInputParts
  (String[] partNames,
   Hashtable<String,Element> partValues) throws Exception

Description

Adds parts to the XML input message, such as the header, body, and so on, according to the input message definition for the selected operation. The default implementation adds the event data payload as the body of the input message. It also adds any other parts provided as event parameters in the triggering event. The event parameters that contain input message parts must be identified by parameter names in the following format:

WFBES_INPUT_<PartName>

Replace <PartName> with the name of the part as it appears in the input message definition from the WSDL. For example:

WFBES_INPUT_header

If you extend the WebServiceInvokerSubscription class, you can override this method to add parts to the XML input message through custom logic. For example, you can set specific input parts that you require, or extend this method to set values for RPC-style Web service invocation.

Note: Currently Oracle E-Business Suite Integrated SOA Gateway supports only document-style Web services by default.

If you provide all the input parts by extending the setInputParts method, then you can leave the event data payload null and you do not need to provide any parts as event parameters. You can also choose to provide some parts through the event data payload or event parameters, and other parts by extending the setInputParts method.

Note: If you provide any of the same input parts both through the event data payload or event parameters, and by extending the setInputParts method, then the part values specified through the setInputParts method override the part values provided in the event.

If the input message processing does not succeed, this method throws an Exception.

Arguments (input)

partNames The list of input part names to add, as an array of java.lang.String.
partValues The java.util.Hashtable object containing the part values that correspond to the specified part names. Ensure that you specify a part value for each part name. Specify each part value as a self-contained XML element of type org.w3c.dom.Element.

addWSSecurityHeader

The addWSSecurityHeader method is called during the invocation processing.

Java Syntax

protected void addWSSecurityHeader
  (ArrayList headersList) throws Exception 

Description

Adds a WS-Security compliant header to the ArrayList object containing the headers that will be added to the Web service request. The default implementation adds the UsernameToken element to the ArrayList based on the WFBES_SOAP_USERNAME, WFBES_SOAP_PASSWORD_MOD, and WFBES_SOAP_PASSWORD_KEY parameters for the subscription or the triggering event. It also sets the expiration time for the header in the Timestamp element based on the WFBES_SOAP_EXPIRY_DURATION parameter for the subscription or the triggering event.

Note: If both the event and the subscription include the WFBES_SOAP_USERNAME, WFBES_SOAP_PASSWORD_MOD, WFBES_SOAP_PASSWORD_KEY, or WFBES_SOAP_EXPIRY_DURATION parameters, then the event parameter values override the subscription parameter values.

If you extend the WebServiceInvokerSubscription class, you can override this method to add any WS-Security header, or to specify custom logic for retrieving the user name and password used to build the UsernameToken element.

If the header processing does not succeed, this method throws an Exception.

Arguments (input)

headersList The ArrayList object containing the list of headers to which the WS-Security compliant header should be added.

addCustomSOAPHeaders

The addCustomSOAPHeaders method is called during the invocation processing.

Java Syntax

protected void addCustomSOAPHeaders
  (ArrayList<Element> customHeaders) throws Exception 

Description

Adds custom SOAP headers to the SOAP request.

If you extend the WebServiceInvokerSubscription class, you can override this method to add one or more custom SOAP headers. Use this method to add any required SOAP headers that are not defined in the input message for the selected operation.

Note: To set input parts that are defined in the input message for the selected operation, use the setInputParts method rather than the addCustomSOAPHeaders method. See: setInputParts.

If the header processing does not succeed, this method throws an Exception.

Arguments (input)

customHeaders The ArrayList object containing the list of custom SOAP headers. Specify each custom header as a self-contained XML element of type org.w3c.dom.Element.

postInvokeService

The WebServiceInvokerSubscription class calls the postInvokeService method after successfully invoking the Web service.

Java Syntax

protected void postInvokeService
  (Subscription eo, 
   BusinessEvent event, 
   WorkflowContext context, 
   String requestData, 
   String responseData) throws BusinessEventException 

Description

Allows processing to be performed on the response received from the Web service, if the operation resulted in a response. The default implementation of this method checks whether an XSL file is specified in the WFBES_OUT_XSL_FILENAME parameter for the subscription or the triggering event, and if so uses that XSL file to transform the XML response. The method also checks whether a callback event and callback agent are specified in the WFBES_CALLBACK_EVENT and WFBES_CALLBACK_AGENT parameters for the subscription or the triggering event. If a callback event is specified, postInvokeService stores the XML response in the event data of that event. If a callback agent is specified, postInvokeService enqueues the callback event onto that agent. Otherwise postInvokeService raises the callback event to the Business Event System locally.

Note: If both the event and the subscription include the WFBES_OUT_XSL_FILENAME, WFBES_CALLBACK_EVENT, and WFBES_CALLBACK_AGENT parameters, then the event parameter values override the subscription parameter values.

If you extend the WebServiceInvokerSubscription class, you can override this method to add further processing after the Web service is invoked. For example, you can process and validate the response and update the application state.

If the post-invocation processing does not succeed, this method throws a BusinessEventException.

Arguments (input)

eo The Subscription object, which provides information about the subscription such as the phase number and parameters.
event The BusinessEvent object, which provides information about the business event that occurred, including the event name, event key, event data, and payload object.
context Workflow context information, including the database connection and the Log object which can be used for logging.
requestData The string that was sent as the Web service request.
responseData The string that was received as the response from the Web service, if any.

get Parameter Methods

The WebServiceInvokerSubscription class includes several methods that return the values of the parameters used during the pre-invocation, invocation, and post-invocation processing.

The following methods return the values of parameters specified in the subscription definition that identify the Web service to invoke.

The following methods return the values of parameters that define further pre-invocation and post-invocation processing. These parameters can appear both within the event parameter list and within the subscription parameter list. If the triggering event contains any of the same parameters as the subscription, the event parameter values override the subscription parameter values.

The following methods return the values of other parameters used in processing the Web service subscription.