Posts

Showing posts from 2012

Google Analytics Tracking for WSO2 API Manager

Image
WSO2 API Manager is a platform for creating, managing, consuming and monitoring APIs. It employs proven SOA best practices to solve a wide range of API management challenges such as API provisioning, API governance, API security and API monitoring.


You can download API Manager latest version from:

http://wso2.com/products/api-manager

and find the online documentation from:

http://docs.wso2.org/wiki/display/AM130/WSO2+API+Manager+Documentation


With WSO2 API Manager 1.3.0 release you can track your API invocations through Google Analytics!

First let me explain you what is google analytics. Google analytics is a service offered by Google which tracks vists to a web site and generates detailed statistics based on those visits.
Now WSO2 API Manager latest 1.3.0 release fascilitates you to integrate with Google Analytics to track run time statistics for API invocations.

Here is the step by step guide to do this.

1. Setup a Google analytics acco…

How to enable remote access to mysql database server

Enable remote access to mySQL database server

1. Open the MySQL server configuration file my.cnf.

sudo gedit /etc/mysql/my.cnf

2. Change the bind-address value to your MySQL server ip. If the MySQL server IP=10.100.2.200, change it as follows, save and close my.cnf file.

bind-address=10.100.2.200

3. Now Grant access to remote IP.
If the remote IP=10.100.2.180

Grant permission to a specific database (ex: testbd)

GRANT ALL ON testdb.* TO testuser@'10.100.2.180' IDENTIFIED BY 'test123';

Grant all permissions

GRANT ALL PRIVILEGES ON *.* TO testuser@'10.100.2.180' IDENTIFIED BY 'test123' WITH GRANT OPTION;

4. Open port 3306, if firewalls are enabled. Following is a sample iptables rule to open Linux iptables firewall.


/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT

5. logout of mysql.

6. Connect from remote host

mysql -u root -h 10.100.2.200 -p

Smooks Entity Persistence Frameworks - Hibernate

With the new Smooks Persistence cartridge in Smooks 1.2, we can directly use several entity persistence frameworks from within Smooks (Hibernate, JPA etc). So in this blog post let's try out the Hibernate sample specified in here. Since smooks have given the basic configurations only, this blog post is going to assist the peolple who need full implementation.
What we are going to do is process the following XML message and store the product information to a bean and persist the order information.


input.xml
------------

1123456112227 First we have to Specify our Entity classes (Order, OrderLine, Product)
//Order class package example.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.*; @Entity @Table(name="orders") public class Order { @Id private Integer ordernumber; @Basic private String customerId; @OneToMany(mappedBy = "order", cascade = CascadeType.ALL) private List orderItems = new ArrayLi…

A way to transform message content in between the client and the backend server - WSO2 Payload Factory Mediator

WSO2 ESB version - 4.0.3

WSO2 PayLoad Factory Mediator is for transforming or replacing message content in between the client and the backend server. Incomming message from client can be transformed by the Payload Factory mediator into the format expected by the service. Then the response message can be formatted into which is expected by the client.
Each argument in the mediator configuration could be a static value or an XPath expression. When an expression is used, argument value is fetched at runtime by evaluating the provided XPath expression against the existing SOAP message. Also the format of the request or response message can be configured which is mapped with the arguments provided in order.
For instance in the following the values for format parameters Code & Price will be assigned with values evaluated from args given in the specified order.

$1$2
A sample service of WSO2 Payload Factory Mediator can be found from here. The sample mediates the incomming message, send t…