XmlObject.Factory.parse("<soapBody>input1,input2</soapBody>"), "This is the start of this workflow");
// BEGIN SERVICE1
{
// prepare to invoke service1
InvocationEntity service1 = notifier.createEntity(myServiceID, SERVICE_1, "NODE1", 1);
InvocationContext service1Invocation = notifier.invokingService(context, service1,
XmlObject.Factory.parse("<soapHeader/>"), XmlObject.Factory.parse("<soapBody>input1</soapBody>"),
"This workflow is invoking a service");
Object result = null;
try {
// prepare to invoke service1
result = runService1(service1, service1.getWorkflowID(), service1.getServiceID(),
service1.getWorkflowNodeID(), service1.getWorkflowTimestep());
// If this were an async invocation, we would have finished
// sending request.
// we acknowledge the successful request.
notifier.invokingServiceSucceeded(context, service1Invocation, "Invoked service1 successfully");
} catch (Exception ex) {
// If there had been a problem sending the request on the wire,
// we acknowledge a failed request.
notifier.invokingServiceFailed(context, service1Invocation, ex, "Failed to invoke service1");
}
// At this point, we would have waited for response from service1 if
// it were an async call.
// assume we received response at this point and continue.
if (result instanceof Success) {
notifier.receivedResult(context, service1Invocation, ((Success) result).header,
((Success) result).body, "got success response from service1");
} else if (result instanceof Failure) {
notifier.receivedFault(context, service1Invocation, ((Failure) result).header, ((Failure) result).body,
"got fault response from service1");
}
}
// BEGIN SERVICE2
{
// prepare to invoke service1
InvocationEntity service2 = notifier.createEntity(myServiceID, SERVICE_2, "NODE2", 2);
InvocationContext service1Invocation = notifier.invokingService(context, service2,
XmlObject.Factory.parse("<soapHeader/>"),
XmlObject.Factory.parse("<soapBody>input2,input3</soapBody>"),
"This workflow is invoking another service");
Object result = null;
try {
// prepare to invoke service2
result = runService2(service2, service2.getWorkflowID(), service2.getServiceID(),
service2.getWorkflowNodeID(), service2.getWorkflowTimestep());
// If this were an async invocation, we would have finished
// sending request.
// we acknowledge the successful request.
notifier.invokingServiceSucceeded(context, service1Invocation, "Invoked service2 successfully");