The Swagger API Console is a JavaScript client that runs in the API Store and makes JavaScript calls from the Store to the API Gateway. You must specify any additional headers that you want to add to the API Console under the CORS CORS ( Cross Origin Resource Sharing ) configuration.
Open the CORS configuration in the <APIM_HOME>/repository/conf/api-manager.xml
file, enable CORS if it is not enabled already and specify the additional headers (SOAPAction
, in this case) under the <Access-Control-Allow-Headers>
element:
...
- Log in to the API Publisher and click the API that you want to invoke (e.g.,
PhoneVerification
). Click the Edit link next to the API's name, navigate down to the API Definition section and click on the
POST
method to expand it.Update the Produces and Consumes fields to
text/xml
and create the following header using the Add Parameter button.Parameter name Values SOAPAction Description: Set to http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber
Parameter Type: Header
Data Type: String
Required: FalseOnce you are done, click Save.
- Log in to the API Store, subscribe to the API and generate an access token for the application you subscribed with.
If it's an API that you are already subscribed to, you might have to re-generate the access token from the Applications page. - Click on the API again to open it and then click its API Console tab.
Expand the POST method, fill the parameter values and invoke the API. For example,
Parameter Value Body This is the example SOAP request that we copied from the SOAP UI of the previous tutorial:
Code Block <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:quer="http://ws.cdyne.com/PhoneVerify/query"> <soapenv:Header/> <soapenv:Body> <quer:CheckPhoneNumber> <!--Optional:--> <quer:PhoneNumber>123456</quer:PhoneNumber> <!--Optional:--> <quer:LicenseKey>0</quer:LicenseKey> </quer:CheckPhoneNumber> </soapenv:Body> </soapenv:Envelope>
Parameter Content Type text/xml SOAPAction http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber Note the result that appears on the console. As you gave an invalid phone number here, the result is invalid.
...