summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-08-16 20:43:22 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-08-16 20:43:22 +0000
commit5c47e0070e3accd5ea57486a1683a6752b3c4d01 (patch)
treee6b0db5ba73525faad0d0b954fe8025c31436c93
parent87e3343790c1603fd62cba2a69cb2e406563da99 (diff)
Correct the DOJO callback configuration and show the result at client and server
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@986127 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/java/calculator/AddServiceImpl.java1
-rw-r--r--sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/webapp/calculate.html14
2 files changed, 8 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/java/calculator/AddServiceImpl.java b/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/java/calculator/AddServiceImpl.java
index 8eabfa6773..e16b352021 100644
--- a/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/java/calculator/AddServiceImpl.java
+++ b/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/java/calculator/AddServiceImpl.java
@@ -37,6 +37,7 @@ public class AddServiceImpl implements AddService {
public AddBean addComplexParam(AddBean aBean) {
aBean.setN3(aBean.getN1() + aBean.getN2());
+ System.out.println("Adding " + aBean.getN1() + " to " + aBean.getN1() + " gives " + aBean.getN3());
return aBean;
}
diff --git a/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/webapp/calculate.html b/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/webapp/calculate.html
index 43d80ec70f..087cc42ddd 100644
--- a/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/webapp/calculate.html
+++ b/sca-java-2.x/trunk/samples/binding-jsonrpc/contribution-calculator-webapp/src/main/webapp/calculate.html
@@ -21,10 +21,11 @@
<head>
<title>Apache Tuscany binding-jsonrpc Calculator WebApp with DOJO Sample</title>
- <script type="text/javascript" src="/dojo/dojo.js"></script>
+ <script type="text/javascript" src="dojo/dojo/dojo.js"></script>
<script type="text/javascript" src="org.oasisopen.sca.componentContext.js"></script>
<script language="JavaScript">
+ dojo.require("dojo.rpc.JsonService");
var addService = new dojo.rpc.JsonService("AddServiceComponent/AddService?smd");
@@ -38,11 +39,11 @@
addRequest.x = 2;
addRequest.y = 3;
- addService.add(addRequest, calculateResponse);
+ addService.addComplexParam(addRequest).addCallback(calculateResponse);
}
function calculateResponse(reply) {
- document.getElementById('result').innerHTML=reply;
+ document.getElementById('result').innerHTML=reply.n3;
}
</script>
@@ -53,11 +54,10 @@
<h2>Apache Tuscany binding-jsonrpc Calculator WebApp with DOJO Sample</h2>
- <input type="text" id="name" width="10">
-
+ 1 + 1 =
<button name="submit" onclick="calculate()">Calculate</button>
- <div id='result'></div>
+ <div id='result'/>
</body>
-</html> \ No newline at end of file
+</html>