Skip to main content

Posts

Generate Application Tokens & User Tokens from WSO2 API Manager

WSO2 API Manager provides a complete solution for publishing APIs,creating and managing a developer community and a scalable routing API trafic .If you are already familiar with this product,you are familiar with its one of basic component -'API Store'. A deployed API Store provides a single place to all third party and internal API consumers to browse available APIs and subscribe to them as they want.If such a consumer follow the subscription process of this store-front UI,he'll notice it's a process of subscribing a selected set of APIs into a application and  giving a result with generated three keys as access token,consumer key and consumer secret adhreing to OAuth 2.0 spec. In other words,it's the process of an Application developer [Say John a mobile app developer] select the APIs which needed to use from his application and subscribe to those APIs from his created application.As the result of this subscription process the application developer,John is...

Running a SQL script at build time of a maven project

The above requirement was arisen while working on an implementation of a WSO2 carbon platform feature.I'm planning to write another blog post on how I acomplish writing that feature in a seperated blog.Until that from this blog,I'll explain,how I achieve one part of that work-Run a database sql script on a specific database while building a maven project.This was achieved through using the Apache Maven AntRun Plugin . This plugin could embed to a maven module pom and simply execute it while building the maven project from its pom.What you have to do is add the sql task as the running goal inside the above plugin as shown in below and the full pom.xml can be found from here .If you are going to add this plugin to a pom.xml of a maven project,add it to section of the pom.Note how the jdbc driver,database url,database username/passwords and the database script defined in the plugin.

Extending WSO2 API Manager

WSO2 API Manager consists with two web applications as APIStore and APIPublisher. APIPublisher UI is important to create/publish APIs and APIStore UI is useful to create applications/subscribe to published APIs. If we think about a use-case of  a company in which adopted the WSO2 APIManager solution; above Store/Publisher apps need to interact with third party users,not only with company internal employees.Such that in real business case,it's really important and useful if below two facts can be achieved through WSO2 API Manager apps.And ofcourse,it has proven that the below facts can be achieved from WSO2 API Manager. Customizing both Store/Publisher apps Customization is really needed,if the company want to host the two apps with using a customized theme and their logos.This can be easily done by the steps described in here . Host Store/Publisher apps in a public domain own by the company Host the apps in a public domain is a real world business requiremen...

Creating a JMeter test plan for an API invocation through WSO2 API Manager

The use-case : Create an API for a REST endpoint and publish it from API-Publisher app Then subscribe to it from API-Store app and generate a key Finally create a test-paln from jmeter to this API invocation with using OAuth access token. Pre-Requesties  : WSO2 Application Server   4.1.2 WSO2 API Manager  1.0.0 Apache JMeter Steps : Deploy the backend JAX-RS Endpoint     First download and extract above two servers and to run both servers simultaneously,change one server's port offset to 1 by navigating to {Product_Home}/repository/conf/carbon.xml . Then download the sample JAX-RS war file from checking out it from here and deploy it to WSO2 AS -4.1.2   This sample JAX-RS contains three REST endpoints and here I'm going to use its endpoint of getting menu list as ' /pizzashack-api-1.0.0/api/menu/ '.Once you deployed the war file,you can check accessing   'http://yourip:port /pizzashack-api-1.0.0/api/menu/ '...

Connecting WSO2 API Manager with different databases

With WSO2 API Manager GA 1.0.0 release,we have tested it with H2 ,My SQL and Oracle databases.The default database used by API Manager is embedded H2 database. But in-case if you want to change the database to either other database,following steps have to be followed. With Carbon 4.0.0 release,it's introduced an unified place to store  all the database data sources related configurations called master-datasources.xml which can be found from {API_Manager_Home}/repository/conf/datasources directory. Open the 'master-datasources.xml' file and you'll notice there are already defined three datasources as;  WSO2_CARBON_DB-The datasource used for registry and user manager WSO2AM_STATS_DB-The datasource used for getting statistics to API Manager WSO2AM_DB-The datasource used for API Manager database If you are going to; Change the database for API Manager  First create a database and run the relevant script which can be found from here ,to gene...

Dealing with SVN Externals

When you are trying to cut a versioned branch from the working trunk directory,an important point that you have to keep on mind is to change the svn externals according to the newly created branch. SVN Externals An SVN externals definition is a mapping of a local directory to the URL—and possibly a particular revision—of a versioned resource. In Subversion, you declare externals definitions in groups using the  svn:externals  property.  Command to view existing svn externals  svn propget -R svn:externals . Command to modify a svn external  If you having one entry as a svn extern property to set on a directory,type below command and then commit it. svn propset svn:externals 'directory  http://external_url' . property 'svn:externals' set on '.' If you having multiple directory/url pairs as svn externs to set on a directory Create a file [ svnExterns.txt ] with putting the individual directory/url pairs. ...

Customizing WSO2 API Store/Publisher App-Part2

From the Part 1 of this tutorial[1], we discussed on overview of API-Store and its directory structure.This tutorial will be focus on the flow of how a user request is handle by API Store web-application front-end and a example to try out. Browser Request Flow of the API-Store Front-end Below image will explain the flow of browser request processing happened inside the API-Store jaggery application.Similarily API-Publisher jaggery application will also handle browser requests. When a user access the API Store/Publisher application through the web-browser,that request will first hit on the relevant page located at 'site/pages' directory in API-Store/Publisher.Then inside that page,to handle the rendering of the web page,it'll call the render() function defined in jagg.jag file resides on location 'jagg/jagg.jag' inside the both applications. To invoke that render() method,we are passing a json string which contains the base page name,page body layout na...