diff options
author | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-15 07:35:40 +0000 |
---|---|---|
committer | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-15 07:35:40 +0000 |
commit | d34795f0b896f5913440841aedddf21dfddf84bd (patch) | |
tree | 169485a34f691f3cc5023de5c2bcca70babe8960 /java | |
parent | e3676a116b86bc61f7cb218f6f5bb4ca21f20d8e (diff) |
Allow BPEL reference invocations to handle WSDL messages with arbitrary part names - TUSCANY-3143
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@794166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r-- | java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java index 15e9229601..67e5eeb722 100644 --- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.implementation.bpel.ode; +import java.util.List; import java.util.concurrent.Callable; import javax.wsdl.Part; @@ -71,10 +72,8 @@ public class ODEExternalService { if (!success) return; - // The invocation must happen in a separate thread, holding - // on the afterCompletion - // blocks other operations that could have been listed there - // as well. + // The invocation must happen in a separate thread, holding on the afterCompletion + // blocks other operations that could have been listed there as well. _server.getExecutor().submit(new Callable<Object>() { public Object call() throws Exception { try { @@ -89,8 +88,7 @@ public class ODEExternalService { RuntimeComponentReference runtimeComponentReference = (RuntimeComponentReference)tuscanyRuntimeComponent.getReferences().get(0); RuntimeWire runtimeWire = - runtimeComponentReference.getRuntimeWire(runtimeComponentReference.getBindings().get(0)); - + runtimeComponentReference.getRuntimeWire(runtimeComponentReference.getEndpointReferences().get(0)); // convert operations Operation operation = findOperation(partnerRoleMessageExchange.getOperation().getName(), runtimeComponentReference); @@ -145,13 +143,7 @@ public class ODEExternalService { } // two way invocation - // process results based on type of message - // invocation - - // Message response = - // createResponseMessage(partnerRoleMessageExchange, - // (Element) result); - // partnerRoleMessageExchange.reply(response); + // process results based on type of message invocation replyTwoWayInvocation(partnerRoleMessageExchange.getMessageExchangeId(), operation, (Element)result); @@ -209,20 +201,30 @@ public class ODEExternalService { } /** - * Get paylod from a given ODEMessage - * @param odeMessage - * @return + * Get payload from a given ODEMessage + * @param odeMessage - the ODE message + * @return the payload of the Message, as a DOM Element */ private Element getPayload(Message odeMessage) { Element payload = null; - Element parameters = odeMessage.getPart("parameters"); - - if (parameters != null && parameters.hasChildNodes()) { - payload = (Element)parameters.getFirstChild(); + + // Get the message parts - these correspond to the message parts for the invocation + // as defined in the WSDL for the service operation being invoked + List<String> parts = odeMessage.getParts(); + if( parts.size() == 0 ) return null; + + // For the present, just deal with the ** FIRST ** part + // TODO Deal with operations that have messages with multiple parts + // - that will require returning an array of Elements, one for each part + Element part = odeMessage.getPart(parts.get(0)); + + // Get the payload which is the First child + if (part != null && part.hasChildNodes()) { + payload = (Element)part.getFirstChild(); } return payload; - } + } // end getPayload private void replyTwoWayInvocation(final String odeMexId, final Operation operation, final Element result) { |