2016-06-09 113 views
0

好日子所有,WSO2 EMM MDM管理员休息webservces

我有添加REST服务问题的MDM管理员

我有一些麻烦与MDM-android- *我创建的服务和refrence在该permition.xml文件

创建于MDM管理员休息服务已sefinitin如下

@GET 
@Path("{type}/{id}/logs") 
public List<? extends Application> getDeviceLogs(

    @PathParam("type") String type, 
    @PathParam("id") String id) 
     throws MDMAPIException { 

     List<Application> applications; 
     ApplicationManagementProviderService appManagerConnector; 
     DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); 

     try { 

      deviceIdentifier.setType(type); 
      deviceIdentifier.setId(id); 
      appManagerConnector = MDMAPIUtils.getAppManagementService(); 

      applications = appManagerConnector.getApplicationListForDevice(deviceIdentifier); 

     } catch (ApplicationManagementException e) { 

      String msg = "Error occurred while fetching the apps of the device."; 
      log.error(msg, e); 
      throw new MDMAPIException(msg, e); 
     } 
     return applications; 
    } 
} 

其应用方法获取列表中只用路径的一个克隆nd函数名称已更改。

当我部署它。我的webapp返回一个错误状态代码。当我尝试调用函数

复制此,下载V2.0.1开放使用Netbeans,修改WSO2 MDM - Mobile Device Management Admin Services 复制并粘贴其余功能之一,Renanme功能部署和调用新的功能

哪有我解决这个问题?

+0

你叫什么路径? – lakshman

+0

{“actionMethod”:“GET”,“actionUrl”:“/ mdm-admin/operations/android/353007060012943/logs”,“actionPayload”:“null”} – user2955481

+0

你使用什么分支?主人还是标签?因为主分支有很多正在进行的开发,所以这可能会改变。我会检查并通知你。对不起,发生了延迟。 – lakshman

回答

0

您的代码段正在为我工​​作没有任何问题。您需要在permission.xml中添加权限条目,如下所示:

<Permission> 
    <name>log device</name> 
    <path>/device-mgt/emm-admin/devices/logs</path> 
    <url>/operations/*/*/logs</url> 
    <method>GET</method> 
</Permission> 

我使用的curl命令如下。不要忘记添加一个内容类型作为application/json。

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 3c28103c1992c9e57d7091fb9f38732e" -k -v https://localhost:9443/mdm-admin/operations/android/000000000000000/logs 
+0

谢谢非常多 – user2955481

+0

Lakshman我修改功能看起来像这样'@GET @Path( “{类型}/{ID} /日志”) 公共字符串getLogs(@PathParam( “ID”)字符串ID) \t \t \t抛出MDMAPIException { 返回 “[{\” ID \“:11 ,\“log \”:\“No logs \”}]“; }'在运行时我在控制台中得到这个Uncaught SyntaxError:意外的JSON输入结束 – user2955481

+0

什么是你得到的日志和响应的完整错误? – lakshman

0

由于您必须将nely aded rest api权限包含在用户中,因此您已获得404。

请将相关权限包含在用户角色中,然后重试。

有关更多信息,请参阅documentation