对Json启用的端点

时间:2016-08-11 18:10:21

标签: json moqui

我正在尝试调用启用Json的端点。

用法为http://xxxxxxxxxx.com/Service.svc/Json/ {{NAME_OF_METHOD}}?param1 = value1& param2 = value2

我有:

<service verb="call" noun="MSTService" type="remote-json-rpc" location="http://xxxxxxxxxx.com/Service.svc/Json" authenticate="false" method="GetTestString">
 <in-parameters>
        <parameter name="theString" type="String" />
 </in-parameters>
 </service>

所以我希望将其解析为像http://xxxxxxxxxx.com/Service.svc/Json/GetTestString?thestring=testString这样的http GET请求(假设我向服务输入“testString”。)

对此请求的回复是:{“d”:“testString ABC”}

我编辑了Re​​moteJsonRpcServiceRunner.groovy,如下所示:

static Map<String, Object> runJsonService(String serviceName, String location, String method,
                                           Map<String, Object> parameters, ExecutionContext ec) {

  String params = "theString=${parameters?.theString}" // Inserted Line
  String jsonRequest = "${method}?${params}"           // Inserted Line

/* Commented following out: 
 *       Map jsonRequestMap = [jsonrpc:"2.0", id:1, method:method, params:parameters]
 *       JsonBuilder jb = new JsonBuilder()
 *       jb.call(jsonRequestMap)
 *       String jsonRequest = jb.toString()
 */
    String jsonResponse =     StupidWebUtilities.simpleHttpStringRequest(location, jsonRequest, "application/json")

但是连接正在超时。任何帮助表示赞赏。

0 个答案:

没有答案