Skip to main content

Posts

Showing posts from 2012

Internationalization Support for APIManager apps

This requirement came from some of the users who are already using WSO2 API Manager product and from WSO2 AM 1.3.0 on wards [released on today],this feature has implemented.You can find WSO2 AM 1.3.0 binary pack from here . Basically for the two apps [Publisher/Store] in WSO2 API Manager,now a developer can change app labels/messages according to the set language in the web browser. From this blog-post,I'll explain the steps to localize publisher app to Spanish,which contains unicode charactors. 1. First set the browser language to your preferred language.  Eg: In Google chrome navigate to Settings->Show advanced settings->;Languages and select your preferred language. 2. set the browser encoding type as UTF-8. 3. Then let's change the publisher app accordingly, Extract your downloaded pack and navigate to the deployed publisher app from the location "AM_Home}/repository/deployment/server/jaggeryapps/publisher". 4. We hav...

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...

Customizing WSO2 API Store/Publisher App-Part1

Up to now,hope most of the audience is familiarized with writing java web applications. Now it's time to write a complete javascript based web application with the help of Jaggery. Jaggery Jaggery is a Server Side Javascript Framework to write web-applications and HTTP-focused web services for all aspects of the application:front-end, communication, server-side logic and persistence in pure javascript. It offers a completely javascript way to write all parts of Web applications and services as a way to reduce/eliminate mismatches across different layers of the Web application and API development experience. Such that it provides closing the gap between web apps from web services by allowing one to create both application and APIs at the same time.For more information visit the site [1] ,which contains more information,API documentation and samples of it. This article will focus on how to write a web application with Jaggery. For that as a real use-case,it'll focus on t...

Validating WSDLs

WSDL : It stands for Web Services Description Language.It's a document written in XML.The document describes a web service.It specifies the location of the service and the operations(or methods) the service expose. There are two versions of WSDLs as WSDL1.0 and WSDL2.0.This blog post will explain how you can validate those two types of WSDLs To validate WSDL 1.0 you can get support of WSDL4J library support and it can be done as follow java code snippet.Relevant  wsdl4j API can be found at here .      javax.wsdl.xml.WSDLReader wsdlReader10 =                                             javax.wsdl.factory.WSDLFactory.newInstance().newWSDLReader();     wsdlReader10.readWSDL(wsdlUrl); To validate WSDL2.0 ,you can get support of apache Wooden library and it can be done as following java code snippet.Relevant wooden API can be found...

Applying a WSDL from a local entry to a proxy service in WSO2 ESB

Local Entry (Local Registry Entry) The local registry acts as a memory registry where an user can store text strings, XML strings, and URLs.  Local entries can be used to hold various configuration elements required by sequences and proxy services. Usually they are used to hold WSDLs, XSDs, XSLT files etc. A local entry can contain XML content as well as plain text content. A local entry can be configured to load content from a  remote file too. WSO2 ESB allows to add new local entries easily using user interface configuration From this blog,I'll explain  how to attach a WSDL to a proxy service from local registry. Note that you can keep a WSDL as a local entry. But it is recommended to keep wsdls in the registry instead, for easier and better management. Below steps will explainhow to add a WSDL from a local entry to a proxy service. Extract WSO2 ESB downloaded pack and start it. Log-in to ESB admin-console. Create the local entry for WSDL. Naviga...

How Facebook Orders Your Search Results

When I logged in to Facebook [when I'm free ;)] and tries to search about a friend ,I always notice some names will listed down with a order very fastly. Have you ever wondered how Facebook orders your search results? Clearly they have some ordering about who they think you are looking for, and they seem to guess pretty well.Facebook order it based on who you interact with, whose profile you look at and who you have recently become friends with.To verify this with a book-marklet ,refer this interesting blog . 

Introduction to WSO2 API Manager

It has been almost a while after my previous blog post.But I'm sure this blog post will be very useful and important for the audience who are keen of software business world. What is API Management ? API Management is a major topic,currently having main discussions and attractions in current software business world which refer as a process of publishing and managing application programming interfaces [APIs]. This have to be achieved through a Software Application known as an API Management Solution. Why ? APIs provide a mechanism to extend data,processes and services.Such that from a API Management Solution what we expect is that supporting for collaboration among internal teams as well external partners. Major Features  The common tasks associated with the process of API Management includes; Governing access to and usage of APIs Helping developers to discover APIs Metering access and usage of APIs Securing APIS through OAuth support How WSO2 API...