public void executeAsynch()

in taverna-wsdl-activity/src/main/java/org/apache/taverna/activities/wsdl/WSDLActivity.java [220:292]


	public void executeAsynch(final Map<String, T2Reference> data,
			final AsynchronousActivityCallback callback) {

		callback.requestRun(new Runnable() {

			public void run() {

				ReferenceService referenceService = callback.getContext()
						.getReferenceService();

				Map<String, T2Reference> outputData = new HashMap<String, T2Reference>();
				Map<String, Object> invokerInputMap = new HashMap<String, Object>();

				try {
					String endpointReference = null;
					for (String key : data.keySet()) {
						Object renderIdentifier = referenceService
								.renderIdentifier(data.get(key), String.class,
										callback.getContext());
						if (isWsrfService()
								&& key.equals(endpointReferenceInputPortName)) {
							endpointReference = (String) renderIdentifier;
						} else {
							invokerInputMap.put(key, renderIdentifier);
						}
					}
					List<String> outputNames = new ArrayList<String>();
					for (OutputPort port : getOutputPorts()) {
						outputNames.add(port.getName());
					}

					T2WSDLSOAPInvoker invoker = new T2WSDLSOAPInvoker(parser,
							configurationBean.get("operation").get("name").textValue(), outputNames,
							endpointReference, credentialManager);

					Map<String, Object> invokerOutputMap = invoker.invoke(
							invokerInputMap, configurationBean);

					for (String outputName : invokerOutputMap.keySet()) {
						Object value = invokerOutputMap.get(outputName);

						if (value != null) {
                                                        Integer depth = getOutputPortDepth(outputName);
							if (depth != null) {
								outputData.put(outputName, referenceService
										.register(value, depth, true, callback
												.getContext()));
							} else {
								logger.info("Skipping unknown output port :"
												+ outputName);
//								// TODO what should the depth be in this case?
//								outputData.put(outputName, referenceService
//										.register(value, 0, true, callback
//												.getContext()));
							}
						}
					}
					callback.receiveResult(outputData, new int[0]);
				} catch (ReferenceServiceException e) {
					logger.error("Error finding the input data for "
							+ getConfiguration().get("operation"), e);
					callback.fail("Unable to find input data", e);
				} catch (Exception e) {
					logger.error("Error invoking WSDL service "
							+ getConfiguration().get("operation"), e);
					callback.fail("An error occurred invoking the WSDL service", e);
				}

			}

		});

	}