1. 调用物的自定义服务,一直返回 500错误,
具体错误信息:content = {"code":500,"id":"121121212","localizedMsg":"服务异常","message":"service provider exception."}
以下是部分代码,还请牛人看看啥问题,多谢了!
2. 自定义方法调用中的method对应TSL文件中的identifier字段指("identifier": "testAsync")吗?
"services": [
{
"outputData": [],
"identifier": "testAsync",
"inputData": [
{
"identifier": "num",
"dataType": {
"specs": {
"min": "0",
"max": "100"
},
"type": "int"
},
"name": "测试"
}
],
"method": "thing.service.testAsync",
"name": "testAsync",
"required": false,
"callType": "sync"
}
],
IoTApiRequest request = new IoTApiRequest();
//设置api的版本
request.setApiVer("1.1.0");
request.setId("121121212");
JSONObject obj = new JSONObject();
obj.put("num", 20);
String cmd = obj.toString();
// 接口参数
request.putParam("productKey", productKey);
request.putParam("inputParams", cmd);
request.putParam("method", "testAsync");
request.putParam("deviceName", deviceName);
ApiResponse response = syncClient.postBody("api.link.aliyun.com", "/thing/device/service/invoke", request, true);
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。