Server User Guide

Server User Guide

Referencing the Custom Invoke Handler Interface in a Java-Based Implementation

Referencing the Custom Invoke Handler Interface in a Java-Based Implementation

The Process Server’s custom invocation handler implements the following interface:
package org.ActiveVOS.wsio.invoke; import org.ActiveVOS.wsio.IAeWebServiceResponse; public interface org.ActiveVOS.wsio.invoke.IAeInvokeHandler { /** * Handles the invoke call. Query data will be null if * none was specified on the customInvokerUri. * @param aInvoke * @param aQueryData */ public IAeWebServiceResponse          handleInvoke           (IAeInvoke aInvoke, String aQueryData); }
where:
  • IAeInvokeHandler
    is the name of the interface. The package is
    org.ActiveVOS.wsio.invoke
    . This interface imports
    org.ActiveVOS.wsio.IAeWebServiceResponse
    .
  • IAeWebServiceResponse
    is the interface for the data or fault that is returned from the calling service.
  • handleInvoke
    is the entry point into the service.
  • aInvoke
    contains the service’s message data and endpoint reference address data from the input message.
  • aQueryData
    contains additional parameters that can be passed in from the
    invokeHandler
    attribute for the partner role in the process deployment descriptor
Code Sample
The following Java code snippet shows an implementation of the interface’s
handleInvoke
method. In this example, a loan approval service receives an amount for a loan approval and returns an “accepted” or “denied” message based on the maximum loan amount allowed.
public IAeWebServiceResponse handleInvoke(IAeInvoke aInvoke,        String aQueryData) {   // Parse the query data section of the uri to create the   // message type qname,   // then create the appropriate response and return.   Map data = parse( aQueryData );   Integer maxLoan = new Integer(      (String)data.get(URI_PARM_MAXLOAN));   String ns = (String)data.get(URI_PARM_MSG_NAMESPACE);   String lp = (String)data.get(URI_PARM_MSG_LOCALPART);   QName messageType = new QName(ns, lp);   // Get input message data.   IAeWebServiceMessageData input = aInvoke.getInputMessageData();   Map input_data = input.getMessageData();   Integer amount = (Integer)input_data.get(MSG_AMOUNT);   // Determine response.   String approval = APPROVER_DENY_RESP;   if ( validateLoan(amount, maxLoan) )        approval = APPROVER_ACCEPT_RESP;   // Build and return response message. Note that in this example,   // the implementation is for a request/response invocation.   // For a request-only invocation, you would not need to   // setMessageData.   Map output_data = new HashMap();   output_data.put(MSG_ACCEPT, approval);   AeWebServiceMessageData msgData = new     AeWebServiceMessageData(messageType, output_data);   AeInvokeResponse response = new AeInvokeResponse();   response.setMessageData( msgData );   return response; }

0 COMMENTS

We’d like to hear from you!