Friday, February 21, 2014

How to call an Admin Service using JMeter

Recently I wanted to invoke an Admin service in API-Manager for a test. My objective was to create a JMeter test script which

  • Login to the server as a TENANT
  • Create an API as the tenant
  • Publish the API
  • MODIFY the API config with new properties
  • Subscribe to the API
  • Invoke the API and check the result. 

To modify the API's synapse config with new properties, I had to invoke the updateApiForTenant  operation in https://localhost:9443/services/RestApiAdmin service.

Step 1: Authorize the service
Created a HTTP Authorization Manager and passed the username and the password as follows:
<stringProp name="Authorization.url">https://${server}:9443/services/RestApiAdmin.RestApiAdminHttpsSoap11Endpoint/</stringProp>
                   <stringProp name="Authorization.username">admin</stringProp>
                    <stringProp name="Authorization.password">admin</stringProp>
                    <stringProp name="Authorization.password">admin</stringProp>                    <stringProp name="Authorization.domain"></stringProp>                    <stringProp name="Authorization.realm"></stringProp>



The required input were the API name, Tenant domain and the API Data. Passing API data was bit tricky. For API data, what is required was the entire API's synapse configuration as a string. After a bit of a struggle, with some assistance, I could figure out the way to pass the API Data.

I passed the entire synapse config in a ![CDATA[     ]]

Hope this will help you!!!


No comments:

Post a Comment