From 93777d8895392ec7b484ae0426a8bdef1149b4d6 Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 30 Nov 2010 16:02:31 +0000 Subject: Add code to process the async response git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1040598 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/UpperSampleAsyncReferenceImpl.java | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/test/java/sampleasync') diff --git a/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java b/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java index 286e619326..d3e91c7f18 100644 --- a/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java +++ b/sca-java-2.x/trunk/unreleased/samples/implementation-sample-async/src/test/java/sampleasync/impl/UpperSampleAsyncReferenceImpl.java @@ -20,6 +20,12 @@ package sampleasync.impl; import static java.lang.System.out; +import static sample.Xutil.elem; +import static sample.Xutil.text; +import static sample.Xutil.xdom; + +import org.w3c.dom.Element; + import sample.api.Java; import sample.api.WSDL; import sample.api.WSDLReference; @@ -35,11 +41,25 @@ public class UpperSampleAsyncReferenceImpl { @WSDL("http://sample/upper#Upper") WSDLReference upper; + String response; public String upper(String s) { out.println("UpperSampleAsyncReferenceImpl.upper(" + s + ")"); - upper.callAsync("upper", null); - return null; + + // TODO - I'm passing in the non-wrapped version of the parameter + // here which doesn't seem right. If I pass in the wrapped + // version then the databinding won't unwrap on the reference + // side as it thinks the target Java interface is bare? + final Element ureq = xdom("http://sample/upper", "s", text(s)); + upper.callAsync("upper", ureq); + + try { + Thread.sleep(500); + } catch (Exception ex) { + // do nothing + } + + return response; } /** @@ -47,7 +67,11 @@ public class UpperSampleAsyncReferenceImpl { * async callback arrives at an operation named * operationName + Callback */ - public void upperCallback(String s) { - out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + s + ")"); + // TODO - I think this should take and Element parameter but the response + // handler interface is a Java interface at the moment and so no + // transformation takes place automatically. + public void upperCallback(String response) { + out.println("UpperSampleAsyncReferenceImpl.upperCallback(" + response + ")"); + this.response = response; } } -- cgit v1.2.3