dynamicSend()

Sends a service request to a consumer of the request which is determined dynamically at run time.

Syntax

protected void dynamicSend(String consumerType, String consumerName, 
   string consumerPort, BusObj busObj, String verb) 
   throws CollaborationException

Parameters

consumerType
ConsumerType is the type of destination to receive the business object. The value can be either BaseCollaboration.CONSUMER_CONNECTOR or BaseCollaboration.CONSUMER_COLLABORATION.
consumerName
ConsumerName is the name of the connector or collaboration.
consumerPort
For a collaboration, consumerPort is the name of the collaboration's port. If a connector is using dynamicSend(), set this parameter to null.
busObj
BusObj is the name of the business object involved in the service request.
verb
Verb is the verb name associated with the service request.

Return values

None.

Examples

The following examples shows how to extract information from a business object and then submit a correctly formed dynamic service call.

BusObj processingBusObj = new BusObj(triggeringBusObj.getType());
processingBusObj.copy(triggeringBusObj);

/* Extract the dynamic service call parameters from the input BO */
String verb = processingBusObj.getVerb();
String consumerName = processingBusObj.getString("ConsumerName");

/* Consumer type should be a collaboration or a connector only */
String consumerType = processingBusObj.getString("ConsumerType");
String consumerPort = null;

if ((consumerType != null ) &&
(!consumerType.equalsIgnoreCase(BaseCollaboration.CONSUMER_CONNECTOR) )&&
(!consumerType.equalsIgnoreCase(BaseCollaboration.CONSUMER_COLLABORATION))) 
{
    // raise an exception here 
    raiseException(AnyException, "Invalid consumer type encountered");
}

if
 (consumerType.equalsIgnoreCase(BaseCollaboration.CONSUMER_COLLABORATION))
 consumerPort = processingBusObj.getString("ConsumerPort");

trace(1, "Making Dynamic Service call with parameters: " +
     "ConsumerName = " + consumerName + " ConsumerType = " + 
      consumerType + " ConsumerPort = " + consumerPort +" Verb = " 
      + verb);

//make a dynamic call
dynamicSend(consumerType, consumerName, consumerPort, processingBusObj, verb);

Notes

Keep the following in mind when adding dynamic service calls to your collaborations:

Copyright IBM Corp. 2004, 2005