Reputation: 61
I've install a WSO2 API-M and try to update the roles of a user.
My request body:
<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>
My response:
<?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>
I try to only delete role is okay, but fail to add new roles.
Is there any one know what's happened?
2016.08.23 updated:
The request of 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>
Thanks
Tom
Upvotes: 0
Views: 128
Reputation: 188
This is how you should send the requests to successfully add/update/delete user roles.
To add and delete roles in the same response:
<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>
To only add new roles (remove deletedRoles element):
<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>
To update new roles:
<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>
Note: If it says zero or more repetitions, remove the entire element if you are not passing any value
Upvotes: 1