com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Include Additional Headers in the API Console

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. Since the API Store and Gateway run on two different ports, we have enabled cross-origin resource sharing (CORS) between the two. You must specify any additional headers that you want to add to the API Console under the CORS configuration.

Open the CORS configuration in <APIM_HOME>/repository/conf/api-manager.xml file, enable CORS if it is not enabled already and specify the additional headers (Content-Type and SOAPAction, in this case) under the <Access-Control-Allow-Headers> element:

CORS configurations in api-manager.xml
 <CORSConfiguration>
    <Enabled>true</Enabled>
    <Access-Control-Allow-Origin>*</Access-Control-Allow-Origin>
    <Access-Control-Allow-Methods>GET,PUT,POST,DELETE,OPTIONS</Access-Control-Allow-Methods>
    <Access-Control-Allow-Headers>tenant, enterprise, authorization, Access-Control-Allow-Origin, Content-Type, SOAPAction</Access-Control-Allow-Headers>
</CORSConfiguration>

This configuration is only valid for APIs created through the API manager Publisher application. All the other Oauth token related APIs (/authorize, /revoke, /token, /userinfo) are not affected from this. To enable CORS configuration to these APIs as well, see "Enabling CORS for Oauth Token related APIs".

Next, let's see how to add the two headers as parameters to the API Console.

  1. Log in to the API Publisher and click the API that you want to invoke (e.g., PhoneVerification).
  2. Click the Edit link next to the API's name, navigate down to the Resources section and click on the POST method to expand it. 

  3. Create the following headers under the POST method using the Add Parameter button.

    Parameter nameValues
    SOAPActionDescription: Set to http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber
    Parameter Type: Header
    Data Type: String
    Required: False
    Content-TypeDescription:
    Set to text/xml
    Parameter Type: Header
    Data Type: String
    Required: False

  4. Once you are done, click Save.

  5. Log in to the API Store, subscribe to the API and generate an access token.
    If it's an API that you are already subscribed to, you might have to renew the access token from the My Subscriptions page.
     
  6. Click on the API again to open it and then click its API Console tab.
  7. Expand the POST method, fill the parameter values and invoke the API. For example,

    ParameterValue
    Body

    This is the example SOAP request that we copied from the SOAP UI of the previous tutorial:

    <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>
    SOAPActionhttp://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber
    Content-Typetext/xml

  8. Note the result that appears on the console. As you gave an invalid phone number here, the result is invalid.

You have added SOAP parameters to the API Console and invoked a SOAP service using the API Console.

Enabling CORS for Oauth Token related APIs

Enabling CORS configuration through api-manager.xml is only valid for APIs created through the API manager Publisher application. Hence enabling CORS for Oauth token related APIs (/authorize, /revoke, /token, /userinfo) can be carried out as follows. 

Based on the API that you need to enable CORS, add the following handler configuration to the relevant API synapse file present in <APIM_HOME>/repository/deployment/server/synapse-configs/default/apifolder. It should be added within the <handlers> parent element.

<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
    <property name="inline" value="ENDPOINT"/>
</handler>

The following are the mappings of the synapse files corresponding to the Oauth token related APIs.

Endpoint
Synapse configuration
/authorize_AuthorizeAPI_.xml
/revoke_RevokeAPI_.xml
/token_TokenAPI_.xml
/userinfo_UserInfoAPI_.xml
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.