// service ID is
assert SERVICE_1.equals(myServiceID);
// if we were not publishing data products, a serviceNotifier would have
// sufficed
ProvenanceNotifier notifier = NotifierFactory.createProvenanceNotifier();
WorkflowTrackingContext context = notifier.createTrackingContext(null, BROKER_URL, myWorkflowID, myServiceID,
myNodeID, myTimestep);
InvocationContext invocationContext = notifier.serviceInvoked(context, myInvoker,
"I (service1) was invoked by my invoker",
AnnotationProps.newProps(AnnotationConsts.AbstractServiceID, myServiceID.toString() + "-abstract")
.toString());
notifier.dataConsumed(context, DATA_URI_1, DATA_URLS_1, "consuming a file");
notifier.dataConsumed(context, DATA_URI_2, DATA_URLS_2, "consuming another file");
// do stuff!
notifier.dataProduced(context, DATA_URI_3, DATA_URLS_3, "produced some file", "<someXml/>");
boolean successResult = true;
// produce response...either success or failure
Object result = null;
if (successResult) {
Success success = new Success();
success.header = XmlObject.Factory
.parse("<S:Header "
+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<wsa:To>http://129.79.246.253:3456</wsa:To><wsa:RelatesTo>uuid:ee4d14d0-2262-11db-86d8-cd518af91949</wsa:RelatesTo>"
+ "</S:Header>");
success.body = XmlObject.Factory
.parse("<S:Body "
+ "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<gfac:Run_OutputParams xmlns:gfac=\"http://org.apache.airavata/namespaces/2004/01/gFac\">"
+ "<gfac:WRF_Ininitialization_Files><value>gsiftp://grid-hg.ncsa.teragrid.org//scratch/hperera/Wed_Aug_02_15_10_23_EST_2006_ARPS2WRF/outputData/namelist.input</value><value>gsiftp://grid-hg.ncsa.teragrid.org//scratch/hperera/Wed_Aug_02_15_10_23_EST_2006_ARPS2WRF/outputData/wrfbdy_d01</value><value>gsiftp://grid-hg.ncsa.teragrid.org//scratch/hperera/Wed_Aug_02_15_10_23_EST_2006_ARPS2WRF/outputData/wrfinput_d01</value></gfac:WRF_Ininitialization_Files>"
+ "</gfac:Run_OutputParams>" + "</S:Body>");
// notify that invocation produced a result and send result to
// invoker
notifier.sendingResult(context, invocationContext, success.header, success.body, "sending success");
try {
// since this is a sync call, we mimic an async response by
// seting the result object
result = success;
// acknowledge that the result was sent successfully
notifier.sendingResponseSucceeded(context, invocationContext);
} catch (Exception ex) {
// acknowledge that sending the result failed
notifier.sendingResponseFailed(context, invocationContext, ex, "error sending response");
}
} else {
Failure failure = new Failure();
failure.header = XmlObject.Factory.parse("<faultHeader/>");
failure.body = XmlObject.Factory.parse("<faultBody>fault1</faultBody>");
// notify that invocation produced a fault and send fault to invoker
notifier.sendingFault(context, invocationContext, failure.header, failure.body, "sending fault");
try {
// since this is a sync call, we mimic an async response by
// seting the result object
result = failure;
// acknowledge that the fault was sent successfully
notifier.sendingResponseSucceeded(context, invocationContext);
} catch (Exception ex) {
// acknowledge that sending the fault failed
notifier.sendingResponseFailed(context, invocationContext, ex, "error sending response");
}
}
// send result
return result;