Test WSO2 API Manager Admin Services Soap APIs Without Known wsdls

Using Soap UI and JMeter

Yasas Rangika Mendis
5 min readJul 16, 2019

WSO2 products are managed internally using SOAP Web services known as admin services. WSO2 products come with a management console UI, which communicates with these admin services to facilitate administration capabilities through the UI.

A service in WSO2 products is defined by the following components:

  • Service component: provides the actual service
  • UI component: provides the Web user interface to the service
  • Service stub: provides the interface to invoke the service generated from the service WSDL

There can be instances where you want to call back-end Web services directly. For example, in test automation, to minimize the overhead of having to change automation scripts whenever a UI change happens, developers prefer to call the underlying services in scripts. Here we are going to discuss how to do it.

Revealing wsdl of a required service

By following these steps you can find out any of the admin services you want. As prerequisites, you need a running API manager product and SoapUI. If you want to do a test with JMeter, I have mentioned here, how to form the request to send via JMeter.

  1. Find the carbon.xml file from this location: <APIM_HOME>/repository/conf/carbon.xml
  2. Find and set the <HideAdminServiceWSDLs> element to false
  3. Now open your terminal or command prompt in your pc and go to the <APIM_HOME>/bin folder and start the API Manager server as follows,

In Linux Environment;

sh wso2server.sh -DosgiConsole

In Windows Environment;

wso2server.bat -DosgiConsole

Setting <HideAdminServiceWSDLs> element false
Start server with -DosgiConsole flag

After the server starts successfully then hit Enter/Return key to go to the OSGI console

osgi console

4. In the OSGI shell, type: osgi> listAdminServices

Listing all the admin services
  • By adding regular expressions you can get specific services by searching as follows;

-If you want to get OAuth services,

listAdminServices | grep OAuth

searching all OAth services by regex

Now we have the service we need. To generate wsdl of that service add ?wsdl at the end of the URL as follows,

https://yasas-ThinkPad-X1-Carbon-3rd:8243/services/RemoteUserStoreManagerService?wsdl

Now we have the wsdl to generate the soap API list we want,

For test soap APIs Soap UI is the best option we can choose. By following a few more steps we can do a successful soap request to the endpoint we have picked.

  1. Open Soap UI and start New SOAP Project with created wsdl
New SOAP project in Soap UI
After loading all Soap API endpoints

2. Now almost set to make a request to the endpoint. Pick one API you need to test and follow the below steps that are done for ‘registerOAuthApplicationData’ endpoint in ‘OAuthAdminService’ service.

1)Give values for required elements

make sure to change the port to 9443 from default 8243 since we are running IS component in API Manger in this example

Making required changes

2) Click the Auth option below in the request tab and add a new basic authorization header.

pass admin/admin for username and password

Adding new authorization

3) Now run the project.

Successful Soap request

Now we are reaching the end of this article.

if you want to make a soap API call from JMeter, it is better to use Soap UI to create the format of the request before do it directly in JMeter.

According to the Soap UI, we have below values;

Soap request body:

<soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=”http://org.apache.axis2/xsd" xmlns:xsd1=”http://dto.oauth.identity.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:registerOAuthApplicationData>
<! — Optional: →
<xsd:application>
<xsd1:applicationName>TestApp</xsd1:applicationName>
<! — Optional: →
<xsd1:callbackUrl>http://test</xsd1:callbackUrl>
</xsd:application>
</xsd:registerOAuthApplicationData>
</soapenv:Body>
</soapenv:Envelope>

Header Values:

Authorization: Basic

In JMeter we have to pass this Authorization value (admin:admin) as converted to base64

Content-Type: text/xml;charset=utf-8
SOAPAction urn: registerOAuthApplicationData

Retrieving required properties from Soap UI

Now open JMeter and create a new test plan and start a new thread group.

1)Add BeanShell PreProcessor to generate base64 header value if you want to automate all the tests. If not you can manually convert the admin:admin into base64.

Base64 header authorization value

2) Now create an HTTP request as follows using values taken from Soap UI

Body of the request

3) Then add an HTTP Header Manager to the request.

Header of the request

4) Now insert a View Results Tree and run the JMeter script.

Invoke soap API by JMeter

Hope now you have some idea about how to invoke a SOAP API we want without having conscious wsdl. All kind of SOAP APIs we can try like this, though this article only focussed API Manager related SOAP APIs.

Wish you all the best with SOAP APIs ☺

--

--

Yasas Rangika Mendis

Software Engineer WSO2 Lanka Private Limited | Bachelor of Computer Science (Special)