WSO2 AM curl命令添加角色

时间:2015-03-24 20:12:29

标签: curl soap wso2 wso2-am

我正在尝试使用curl将角色和用户添加到碳中。我按照这里的步骤进行了操作:http://soasecurity.org/2013/12/10/user-role-management-with-wso2-identity-server-apis/

这使我能够使用soapUI来做到这一点。但是当我尝试使用curl时,我无法让它工作。这是我的curl命令:

curl -k --basic -u "admin:admin" --header "Content-Type: text/xml;charset=UTF-8" --data @soaprole.xml https://localhost:9443/services/RemoteUserStoreManagerService.RemoteUserStoreManagerServiceHttpsSoap11Endpoint

我收到以下错误:

<faultstring>The endpoint reference (EPR) for the Operation not found is https://localhost:9443/services/RemoteUserStoreManagerService.RemoteUserStoreManagerServiceHttpsSoap11Endpoint and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.</faultstring>

这是我的xml文件:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.um.carbon.wso2.org" xmlns:xsd="http://dao.service.ws.um.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:addRole>
<ser:roleName>creator</ser:roleName>
<ser:permissions>
<xsd:action>ui.execute</xsd:action>
 <xsd:resourceId>/permission/admin/Manage/API</xsd:resourceId>
     </ser:permissions>
     <ser:permissions>
        <xsd:action>ui.execute</xsd:action>
        <xsd:resourceId>/permission/admin/login</xsd:resourceId>
     </ser:permissions>
  </ser:addRole>
</soapenv:Body>
</soapenv:Envelope>

我错过了什么?

2 个答案:

答案 0 :(得分:0)

您可以访问RemoteUserStoreManagerService吗?确保在carbon.xml上启用<hideadminservicewsdl>选项,并尝试从浏览器访问上述服务的wsdl。

例如:https://localhost:9443/services/RemoteUserStoreManagerService?wsdl应显示管理服务wsdl。

答案 1 :(得分:0)

我的curl命令中输入了一个错误导致问题。这就是我现在正在使用它并且它正在工作:

curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -k --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:urn:addRole" -d @soaprole.xml --url https://localhost:9443/services/RemoteUserStoreManagerService.RemoteUserStoreManagerServiceHttpsSoap11Endpoint