How is the best way to delete a tenant in WSO2 carbon? - wso2

I'm trying to delete a tenant using the method "deleteTenant" in the class "TenantMgtAdminServiceStub" but it didn't works, it shows an error. I'm wondering if this is the best way to delete a tenant... I was looking for help and I found this post but is not a possibility restart the server every time I want to delete a tenant.
Days before I post this with the error I got when I use that method.
Thanks!

Tenants once created from the UI cannot be deleted from the UI. However, Using the deleteTenant operation of RemoteTenantManagerService we can delete a tenant. This am basing on a product like API-Manager1.9.0
To access this RemoteTenantManagerService as https://localhost:9443/services/RemoteTenantManagerService?wsdl follow the following steps
step1: set the following property to false in vi ../repository/conf/carbon.xml <HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>
step2: start the server and then access https://localhost:9443/services/RemoteTenantManagerService?wsdl via soap ui
step3: if a tenant is created each tenant should have a tenant id which we need to pass
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.um.carbon.wso2.org">
<soapenv:Header/>
<soapenv:Body>
<ser:deleteTenant>
<!--Optional:-->
<ser:tenantId>?</ser:tenantId>
</ser:deleteTenant>
</soapenv:Body>
</soapenv:Envelope>
Note: if you are to create a tenant with the same name you will need to restart the server
regards,shavantha

Related

WSO2 IS 5.9.0 Updating user claims

I have two problems, when use the method setUserClaimValue from RemoteUserStoreManagerService SOAP endpoint, the update, works good.
But, the endpont /userinfo lost the values, I need to re-authenticate the user for generate a new access token and all works good again.
I need use the method setUserClaimValue from RemoteUserStoreManagerService for update more than one claim, but nothing happend, I don't have any error but the claims were not updated.
This is my env:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.um.carbon.wso2.org" xmlns:xsd="http://common.mgt.user.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:setUserClaimValues>
<!--Optional:-->
<ser:userName>username#mail.com</ser:userName>
<!--Zero or more repetitions:-->
<ser:claims>
<!--Optional:-->
<xsd:claimURI>http://wso2.org/claims/emailaddress</xsd:claimURI>
<!--Optional:-->
<xsd:value>newemail#mail.com</xsd:value>
</ser:claims>
<!--Optional:-->
<ser:profileName></ser:profileName>
</ser:setUserClaimValues>
</soapenv:Body>
</soapenv:Envelope>
What method I should use for update more thant one claim?
Why when update claims, my actual access token lost data from /userinfo endpoint, and is it necessary to generate a new access token?
1)
What method I should use for update more thant one claim?
You have to use setUserClaimValues from RemoteUserStoreManagerService. You can follow this document for further information on this RemoteUserStoreManagerService.
A sample soap service is given below.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.ws.um.carbon.wso2.org" xmlns:xsd="http://common.mgt.user.carbon.wso2.org/xsd">
<soap:Header/>
<soap:Body>
<ser:setUserClaimValues>
<ser:userName>piraveena</ser:userName>
<ser:claims>
<xsd:claimURI>http://wso2.org/claims/organization</xsd:claimURI>
<xsd:value>wso2</xsd:value>
</ser:claims>
<ser:claims>
<xsd:claimURI>http://wso2.org/claims/country</xsd:claimURI>
<xsd:value>srilanka</xsd:value>
</ser:claims>
<ser:profileName>default</ser:profileName>
</ser:setUserClaimValues>
</soap:Body>
</soap:Envelope>
2)
Why when update claims, my actual access token lost data from
/userinfo endpoint?
I couldn't reproduce this issue locally. I was able to obtain the userclaims without reauthenticating even after updating the claims via admin service.
When user claim is updated, the userattribute cache which is mapped against the accesstoken also will be cleared by an event. So the next time when you call the useinfo endpoint, the cache will be empty. In that case, the claim will be obtained from userstore. Please refer to this code here. Due to this, the user doesn't need to reauthenticate since the userattributes exist in the userstore.
But you may face this issue when you have enabled email as username and you update the email of the user via the service.

Cannot consume Talend Soap API

I am trying to use the Tsoap component within Talend to consume the API. I have tried the Soap UI Client (separate application) and was able to get the response.
However within the Tsoap component within the Soap Message, I have pasted the sample request and I get an error eery single time. Can anyone help!
" <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns=\"http://clients.mindbodyonline.com/api/0_5\">
<soapenv:Header/>
<soapenv:Body>
<GetSites>
<Request>
<SourceCredentials>
<SourceName>Test235</SourceName>
<Password>3IERKOFDNFEOFMKDFOEMFD=</Password>
<SiteIDs>
<int>-99</int>
</SiteIDs>
</SourceCredentials>
<XMLDetail>Full</XMLDetail>
<PageSize>0</PageSize>
<CurrentPageIndex>0</CurrentPageIndex>
</Request>
</GetSites>
</soapenv:Body>
</soapenv:Envelope>"
What am I doing wrong?? Can anyone help please.
Can you send the error what you are getting?
Try this if you haven't done (just a guess)
--> If you are using and HTTPS web service then make sure to setup the authentication( I used Trust serve with SLL and provided the keystore file path and password)

WSO2 ESB : how to retrive the Carbon Applications List

for monitoring purpose I was looking for a way, possibly via JMX or SNMP, to retrieve the Carbon Applications List and for each one of those the version.
I googled and read the docs but wasn't able to find anything
Any idea ?
TIA
Max
You can view the list or carbon apps deployed by calling admin services.
To get the list of carbon apps you should invoke ApplicationAdmin admin service.
Admin Service URL: https://localhost:9443/services/ApplicationAdmin
Sample Request Payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mgt="http://mgt.application.carbon.wso2.org">
<soapenv:Header/>
<soapenv:Body>
<mgt:listAllApplications/>
</soapenv:Body>
</soapenv:Envelope>
Sample Response Payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:listAllApplicationsResponse xmlns:ns="http://mgt.application.carbon.wso2.org" xmlns:ax21="http://mgt.application.carbon.wso2.org/xsd">
<ns:return>ContainerAPICompositeApplication_1.0.0</ns:return>
<ns:return>SalesforceCompositeProject_1.0.0</ns:return>
</ns:listAllApplicationsResponse>
</soapenv:Body>
</soapenv:Envelope>
Make sure you pass in the authenticated session ID when making the request. You can find more details on this at : http://itsmaheeka.blogspot.com/2016/06/wso2-admin-services.html

Creating application with permissions using webservice API

I'm trying to create a serviceProvider including permissions using the webservice API of WSO2IS 5.1.0
The API I'm using is the one you can find on https://docs.wso2.com/display/IS510/Identity+Application+Management+API
Simply creating a serviceProvider with the request below works fine.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://model.common.application.identity.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:createApplication>
<xsd:serviceProvider>
<xsd1:applicationName>APP_NAME</xsd1:applicationName>
<xsd1:description>My application name</xsd1:description>
</xsd:serviceProvider>
</xsd:createApplication>
Trying to create a serviceProvider with permissions with the request below fails with the message
Error while storing permissions for application APP_NAME
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://model.common.application.identity.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:createApplication>
<xsd:serviceProvider>
<xsd1:applicationName>APP_NAME</xsd1:applicationName>
<xsd1:description>My application name</xsd1:description>
<xsd1:permissionAndRoleConfig>
<xsd1:permissions>
<xsd1:value>permission1</xsd1:value>
</xsd1:permissions>
</xsd1:permissionAndRoleConfig>
</xsd:serviceProvider>
</xsd:createApplication>
I cannot find any further information in the logs and also the example request messages on the WSO2 documentation site are lacking any information.
Any help or suggestion is welcome

Update user password methods breaks in external Read Write LDAP mode of WSO2 Identity Server

I am using a external ApacheDS LDAP with WSO2 IS. I can update user password via Management Console very well. It works fine. Then I tried to use UserAdmin service to do this. I used the changePasswordByUser method in that. I have consumed the service using SOAPUI. I can send the first update request fine. I looked at the LDAP and the update is succeeded. I can log in to Management Console using the updated password.
When I tried to update it for the second time onwards using the updated password, its sends this response,
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>Can not access the directory service</faultstring>
<detail>
<ns:UserAdminUserAdminException xmlns:ns="http://org.apache.axis2/xsd">
<UserAdminException xsi:type="ax2627:UserAdminException" xmlns="http://org.apache.axis2/xsd"
xmlns:ax2627="http://common.mgt.user.carbon.wso2.org/xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax2627:message>Can not access the directory service</ax2627:message>
</UserAdminException>
</ns:UserAdminUserAdminException>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Audit logs says,
[2014-05-29 16:32:53,078] INFO - 'demoTest#carbon.super [-1234]' logged in at [2014-05-29 16:32:53,077+0000]
[2014-05-29 16:32:53,204] INFO - Initiator : demoTest#carbon.super | Action : Change Password by User | Target : demoTest#carbon.super | Data : { } | Result : Failed
No other exception in the logs :( Can anyone help me to get this solved?
Found the problem! The LDAP is not allowing the password to be set back to values which are used in reason history. Need to disable that. That's why admin service has failed. You can use ads-pwdInHistory property in ApacheDS to do this.