}
protected void handleWSComponent(Node node) throws WorkflowException {
WSComponent wsComponent = ((WSComponent) node.getComponent());
QName portTypeQName = wsComponent.getPortTypeQName();
Invoker invoker = this.invokerMap.get(node);
// We do this because invokers cannot be cached because the puretls expires
if (invoker != null) {
this.invokerMap.remove(invoker);
}
final WSNode wsNode = (WSNode) node;
String wsdlLocation = InterpreterUtil.getEPR(wsNode);
final String gfacURLString = this.getConfig().getConfiguration().getGFacURL().toString();
if (null == wsdlLocation) {
/* If there is a instance control component connects to this
* component send information in soap header */
for (Node n : wsNode.getControlInPort().getFromNodes()) {
if (n instanceof InstanceNode) {
AmazonSecurityContext amazonSecurityContext;
final String awsAccessKeyId = config.getAwsAccessKey();
final String awsSecretKey = config.getAwsSecretKey();
final String username = ((InstanceNode) n).getUsername();
if (((InstanceNode) n).isStartNewInstance()) {
final String amiId = ((InstanceNode) n).getIdAsValue();
final String instanceType = ((InstanceNode) n).getInstanceType();
amazonSecurityContext =
new AmazonSecurityContext(username, awsAccessKeyId, awsSecretKey, amiId, instanceType);
} else {
final String instanceId = ((InstanceNode) n).getIdAsValue();
amazonSecurityContext =
new AmazonSecurityContext(username, awsAccessKeyId, awsSecretKey, instanceId);
}
this.config.getConfiguration().setAmazonSecurityContext(amazonSecurityContext);
}
}
if ((this.config.isGfacEmbeddedMode()) || (config.getAwsAccessKey() != null)) {
invoker = new EmbeddedGFacInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
this.config.getMessageBoxURL().toASCIIString(), this.config.getMessageBrokerURL().toASCIIString(), this.config.getNotifier(),
this.config.getTopic(), this.config.getAiravataAPI(), portTypeQName.getLocalPart(), this.config.getConfiguration());
} else {
invoker = new GenericInvoker(portTypeQName, WSDLUtil.wsdlDefinitions5ToWsdlDefintions3(wsNode.getComponent().getWSDL()), node.getID(),
this.config.getMessageBoxURL().toASCIIString(), gfacURLString, this.config.getNotifier());
}
} else {
if (wsdlLocation.endsWith("/")) {
wsdlLocation = wsdlLocation.substring(0, wsdlLocation.length() - 1);
}
if (!wsdlLocation.endsWith("?wsdl")) {
wsdlLocation += "?wsdl";
}
invoker = new GenericInvoker(portTypeQName, wsdlLocation, node.getID(), this.getConfig().getConfiguration().getMessageBoxURL().toString(),
gfacURLString, this.config.getNotifier());
}
invoker.setup();
this.invokerMap.put(node, invoker);
invoker.setOperation(wsComponent.getOperationName());
// find inputs
List<DataPort> inputPorts = node.getInputPorts();
ODEClient odeClient = new ODEClient();
for (DataPort port : inputPorts) {
Object inputVal = InterpreterUtil.findInputFromPort(port, this.invokerMap);
/*
* Need to override inputValue if it is odeClient
*/
if (port.getFromNode() instanceof InputNode) {
inputVal = WorkflowInputUtil.parseValue((WSComponentPort) port.getComponentPort(), (String) inputVal);
}
if (null == inputVal) {
throw new WorkFlowInterpreterException("Unable to find inputs for the node:" + node.getID());
}
if (port.getFromNode() instanceof EndForEachNode) {
inputVal = WorkflowInputUtil.parseValue((WSComponentPort) port.getComponentPort(), (String) inputVal);
// org.xmlpull.v1.builder.XmlElement inputElem = XMLUtil
// .stringToXmlElement3("<" + port.getName() + ">"
// + inputVal.toString() + "</" + port.getName()
// + ">");
// inputVal = inputElem;
}
invoker.setInput(port.getName(), inputVal);
}
invoker.invoke();
}