summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-11-16 18:48:27 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-11-16 18:48:27 +0000
commit3b13b2066f00bdf9f1a65c5402cb7aa5e2fa5710 (patch)
tree5638f7945803b67e57cf6b34a103ed5b679cddfb /sca-java-2.x/trunk/modules/binding-jsonrpc-runtime
parent9f87d8a626b0460eba1c8481bc6ea4c2a2d7754d (diff)
Fix the return type to match the object[] for output
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1035743 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jsonrpc-runtime')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
index 9691910893..b58fbb9f53 100644
--- a/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
@@ -140,8 +140,12 @@ public class JSONRPCBindingInvoker implements Invoker, DataExchangeSemantics {
if (!jsonResponse.has("result")) {
processException(jsonResponse);
}
- DataType outputType = operation.getOutputType();
- if (outputType == null) {
+ DataType<List<DataType>> outputType = operation.getOutputType();
+ DataType returnType =
+ (outputType != null && !outputType.getLogical().isEmpty()) ? outputType.getLogical().get(0)
+ : null;
+
+ if (returnType == null) {
msg.setBody(null);
return msg;
}
@@ -156,14 +160,14 @@ public class JSONRPCBindingInvoker implements Invoker, DataExchangeSemantics {
processException(jsonResponse);
}
- Class<?> returnType = outputType.getPhysical();
- Type genericReturnType = outputType.getGenericType();
+ Class<?> returnClass = returnType.getPhysical();
+ Type genericReturnType = returnType.getGenericType();
- ObjectMapper mapper = createObjectMapper(returnType);
+ ObjectMapper mapper = createObjectMapper(returnClass);
String json = rawResult.toString();
// Jackson requires the quoted String so that readValue can work
- if (returnType == String.class) {
+ if (returnClass == String.class) {
json = "\"" + json + "\"";
}
Object body = mapper.readValue(json, TypeFactory.type(genericReturnType));