Server User Guide > Custom Invoke Handlers > 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:
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;
}