Sends a service request to a consumer of the request which is determined dynamically at runtime.
Syntax
protected void dynamicSend(String consumerType, String consumerName, string consumerPort, BusObj busObj, String verb) throws CollaborationException
Parameters
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: