wso2 emm mdm-admin 休息网络服务

wso2 emm mdm-admin Rest webservices

大家好,

我在向 mdm-admin 添加 Rest 服务时遇到问题

我在使用 mdm-android-* 我在 permission.xml 文件

中创建了服务和引用

在 mdm-admin 中创建休息服务,它具有如下 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;
    }
}

是应用方法获取列表的克隆,只是改变了路径和函数名。

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

要复制这个,下载 v2.0.1 用 Netbeans 打开,修改 WSO2 MDM - Mobile Device Management Admin Services 复制并粘贴其余函数之一,重命名函数 Deploy 并调用该新函数

我该如何解决?

您将收到 404,因为您必须向用户添加最新的 api 权限。

请包含对用户角色之一的相关权限,然后重试。

请参阅 documentation 了解更多信息。

你的代码片段对我来说没有任何问题。您需要按如下方式在 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