diff options
Diffstat (limited to 'sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java')
-rw-r--r-- | sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java b/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java index ff84db1d1a..19d518e44c 100644 --- a/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java +++ b/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java @@ -24,8 +24,12 @@ import java.util.HashMap; import java.util.Map; import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.invocation.Constants; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.w3c.dom.Element; @@ -37,14 +41,19 @@ import sample.api.WSDLReference; class SampleWSDLProxy implements WSDLReference { final RuntimeEndpointReference repr; final Map<String, Operation> ops; + final ExtensionPointRegistry ep; + final MessageFactory mf; - SampleWSDLProxy(EndpointReference epr, Interface wi) { + SampleWSDLProxy(EndpointReference epr, Interface wi, ExtensionPointRegistry ep) { + this.ep = ep; + mf = ep.getExtensionPoint(MessageFactory.class); + repr = (RuntimeEndpointReference)epr; ops = new HashMap<String, Operation>(); for(Operation o: wi.getOperations()) ops.put(o.getName(), o); } - + @Override public Element call(String op, Element e) { try { @@ -54,4 +63,20 @@ class SampleWSDLProxy implements WSDLReference { throw new RuntimeException(ex); } } + + @Override + public void callAsync(String op, Element e) { + // Asynchronously invoke the named operation on the endpoint reference + Message message = mf.createMessage(); + message.setBody(message); + + // We could add implementation specific headers here if required + + repr.invokeAsync(ops.get(op), message); + + String messageID = (String) message.getHeaders().get(Constants.MESSAGE_ID); + + // save the message id ready for when we process the response + + } } |