WSO2:通过网络服务更新用户角色
WSO2: Update roles of user via web services
我已经安装了 WSO2 API-M 并尝试更新用户的角色。
我的请求正文:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd">
<soap:Header/>
<soap:Body>
<xsd:addRemoveRolesOfUser>
<!--Optional:-->
<xsd:userName>tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoles>internal/subscriber</xsd:newRoles>
<!--Zero or more repetitions:-->
<xsd:deletedRoles>admin</xsd:deletedRoles>
</xsd:addRemoveRolesOfUser>
</soap:Body>
</soap:Envelope>
我的回复:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Error occurred while getting
database type from DB connection</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
我试过只删除角色没问题,添加新角色失败
有没有人知道发生了什么事?
2016.08.23更新:
updateRolesOfUser请求:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd">
<soap:Header/>
<soap:Body>
<xsd:updateRolesOfUser>
<!--Optional:-->
<xsd:userName>?</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoleList>?</xsd:newRoleList>
</xsd:updateRolesOfUser>
</soap:Body>
</soap:Envelope>
谢谢
汤姆
这就是您应该如何将请求成功发送到 add/update/delete 用户角色。
在同一响应中添加和删除角色:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRemoveRolesOfUser>
<!--Optional:-->
<xsd:userName>Tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoles>admin</xsd:newRoles>
<!--Zero or more repetitions:-->
<xsd:deletedRoles>test</xsd:deletedRoles>
</xsd:addRemoveRolesOfUser>
</soapenv:Body>
</soapenv:Envelope>
仅添加新角色(删除 deletedRoles 元素):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRemoveRolesOfUser>
<!--Optional:-->
<xsd:userName>Tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoles>admin</xsd:newRoles>
</xsd:addRemoveRolesOfUser>
</soapenv:Body>
</soapenv:Envelope>
要更新新角色:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:updateRolesOfUser>
<!--Optional:-->
<xsd:userName>Tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoleList>test</xsd:newRoleList>
<xsd:newRoleList>admin</xsd:newRoleList>
<xsd:newRoleList>Internal/subscriber</xsd:newRoleList>
</xsd:updateRolesOfUser>
</soapenv:Body>
</soapenv:Envelope>
注意:如果它说零次或多次重复,如果您没有传递任何值,请删除整个元素
我已经安装了 WSO2 API-M 并尝试更新用户的角色。
我的请求正文:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd">
<soap:Header/>
<soap:Body>
<xsd:addRemoveRolesOfUser>
<!--Optional:-->
<xsd:userName>tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoles>internal/subscriber</xsd:newRoles>
<!--Zero or more repetitions:-->
<xsd:deletedRoles>admin</xsd:deletedRoles>
</xsd:addRemoveRolesOfUser>
</soap:Body>
</soap:Envelope>
我的回复:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Receiver</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">Error occurred while getting
database type from DB connection</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail />
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
我试过只删除角色没问题,添加新角色失败
有没有人知道发生了什么事?
2016.08.23更新:
updateRolesOfUser请求:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd">
<soap:Header/>
<soap:Body>
<xsd:updateRolesOfUser>
<!--Optional:-->
<xsd:userName>?</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoleList>?</xsd:newRoleList>
</xsd:updateRolesOfUser>
</soap:Body>
</soap:Envelope>
谢谢
汤姆
这就是您应该如何将请求成功发送到 add/update/delete 用户角色。
在同一响应中添加和删除角色:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRemoveRolesOfUser>
<!--Optional:-->
<xsd:userName>Tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoles>admin</xsd:newRoles>
<!--Zero or more repetitions:-->
<xsd:deletedRoles>test</xsd:deletedRoles>
</xsd:addRemoveRolesOfUser>
</soapenv:Body>
</soapenv:Envelope>
仅添加新角色(删除 deletedRoles 元素):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:addRemoveRolesOfUser>
<!--Optional:-->
<xsd:userName>Tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoles>admin</xsd:newRoles>
</xsd:addRemoveRolesOfUser>
</soapenv:Body>
</soapenv:Envelope>
要更新新角色:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:updateRolesOfUser>
<!--Optional:-->
<xsd:userName>Tom</xsd:userName>
<!--Zero or more repetitions:-->
<xsd:newRoleList>test</xsd:newRoleList>
<xsd:newRoleList>admin</xsd:newRoleList>
<xsd:newRoleList>Internal/subscriber</xsd:newRoleList>
</xsd:updateRolesOfUser>
</soapenv:Body>
</soapenv:Envelope>
注意:如果它说零次或多次重复,如果您没有传递任何值,请删除整个元素