Thursday, September 24, 2015

Exposing the WSO2 Admin service as REST service

There can be a situation where you want to invoke the wso2 admin services from your external custom management tool. This post is taking a single use case where, making the WSO2 admin service for blocking users as a REST service.

<api name="UserProfileMgtRestServices" context="/UserProfileMgtRestServices">
<resource methods="GET" uri-template="/getUserProfiles/{userId}">
<inSequence>
<payloadFactory media-type="xml">
<format>
<mgt:getUserProfiles xmlns:mgt="http://mgt.profile.user.identity.carbon.wso2.org">
<mgt:username>$1</mgt:username>
</mgt:getUserProfiles>
</format>
<args>
<arg evaluator="xml" expression="get-property('uri.var.userId')"/>
</args>
</payloadFactory>
<property name="messageType" value="application/xml" scope="axis2"/>
<property name="ContentType" value="application/xml" scope="axis2"/>
<header name="Action" value="urn:getUserProfiles"/>
<send>
<endpoint>
<address uri="https://localhost:9443/services/UserProfileMgtService.UserProfileMgtServiceHttpsSoap11Endpoint"
format="soap11"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<property name="messageType" value="application/json" scope="axis2"/>
<property name="ContentType" value="application/json" scope="axis2"/>
<send/>
</outSequence>
</resource>
</api>

No comments:

Post a Comment