summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-11-24 11:54:23 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-11-24 11:54:23 +0000
commit6b12e75324692b5420e4bd5c4382c7c1847359ad (patch)
tree31fe970352fee08594743ee0c25d7d5267e52870 /sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java
parentf75785eaf5609362c59a2e426fc1cee974f460a0 (diff)
Changes to move toward supporting async operation in the sample implementation. Won't compile until I get the infrastructure changes checked in.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1038570 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/main/java/sampleasync/impl/SampleWSDLProxy.java29
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
+
+ }
}