This documentation is for WSO2 App Factory 1.0.0. View documentation for the latest release.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  1. Log in to App Factory portal and click Add New Application to create a new application with the following specifications:

    Name: API-Invoker
    Application Type: Web Application
    Repository Type: Git

    For more information on creating applications, see Creating and Viewing Applications.
  2. C heck out the API-Invoker source code using the Git clone command. It's folder structure is as follows:
  3. Replace the WebContent/index.jsp file you find in the above folder structure with the sample index.jsp file found in either <AF_HOME>/samples/API_Invoker directory. You can find the same file here: API_Invoker/API_Invoker/WebContent/ index.jsp. 

    This sample index.jsp has the following code segment added
    to get keys by calling the CarbonContext and Registry APIs. The correct sandbox and production keys (consumer key and consumer secret) are used depending on where the application is deployed.

    Code Block
    CarbonContext cCtx = CarbonContext.getCurrentContext();
            Registry registry = (Registry) cCtx.getRegistry(RegistryType.SYSTEM_GOVERNANCE);
        	//curl -v -H "Authorization: Bearer KY7QoTynVZShrfguQGTNPST88X8a"  	
            Resource resource = registry.get("dependencies/consumerkey");
            if(resource.getContent() instanceof String){
            	consumerkey = (String) resource.getContent();
            	consumerkey = new String((byte[]) resource.getContent());
            resource = registry.get("dependencies/consumersecret");
            if(resource.getContent() instanceof String){
            	secretkey = (String) resource.getContent();
            	secretkey = new String((byte[]) resource.getContent());
  4. After replacing the file, commit the changes to Git repository.  

  5. Next, subscribe to the yahooweather API using the application created above. Steps below cover this:

    • Log in to the App Factory portal and select the API-Invoker application created before.
    • Select the Resources tab from the left panel and scroll down to select APIs section. Then, click Subscribe to APIs.
    • The API Manager's storefront opens in a separate window: It lists all APIs published to the store, including yahooweather - 1.0.0 API you created and published earlier.
    • Click the yahooweather - 1.0.0 API to open its details. Select API-Invoker from Applications drop down and Subscribe.

  6. After subscribing, you get options to generate access keys. Generate keys for sandbox and production separately.    
  7. Next, come back to the App Factory portal and select the Repos and Builds tab. Build and Deploy API-Invoker application in the development environment by simply clicking the relevant buttons in the UI screen.
  8. Launch the application by clicking the Test button and providing the following parameters.

  9.  Submit Submit the details to receive response response with weather information will be printed as an XML file.  


  1. Promote the application to


  1. Production


  1. environment and view results. For details on how to promote applications, see Promoting an application.

Note: The results of Development environment  differs from Production environment because the keys that is used by the two environments are different. The programmer is unaware about the sandbox and production keys, and everything is handled underneath.