Sunday, March 22, 2015

How To integrate WSO2 BPS server with WSO2 API Manager


Introduction
In this tutorial I will show how to integrate WSO2 API Manager with WSO2 BPS Server

Use Case

Company A  is API publishing company and this company want to manage the subscribers come into their API Store . In order to make this use case success we use WSO2 Business Process Server to handle the requests come into the store.

Types of Requests Handle by the BPS
  • User Signup Workflow 
  • Application Creation Workflow
  • Application Registration Workflow
  • API Subscription Workflow

Prerequisite


  • WSO2 API Manager (you can Download from here) .
  • WSO2 Business Process Server ( you can Download it from here) .

Deployment Diagram


Deployment Diagram




  • Unzip the WSO2 API Manager and start the server .
  • Unzip the WSO2 BPS and change the portoffset to 2 from the carbon.xml in the <BPS_Home>/repository/conf.
  • Copy <AM_HOME>/business-process/epr folder into the <BPS_HOME>/repository/conf folder and start the server.
  • Log into the BPS management Console from https://<hostname>:9445/carbon .
  • Deploy Human Task Zip file and the Business Process zip file from the <AM_Home>/business-process/user-signup .
  • Log into the management console in WSO2 API Manager from https://<hostname>:9443/carbon.
  • find workflow-extension.xml from registry on /_system/governance/apimgt/applicationdata/workflow-extensions.xml and change the configurations according to following workflow-extensions.xml
workflow-extenstions.xml

After successfully configured the server you can check the functionality as follows.

  • Go to API Store from https://<hostname>:9443/store
  • Go to signup and Create subscriber.
  • After Do Signup you'll acknowledge with following message from Store
Signup Notification From Store
After this step admin can approve your account from login to the admin-dashboard in API Manager.









Saturday, March 21, 2015

How To Create Axis2 Client for Axis2 Service using Maven


This Article is continuation of previous article on How to Create Axis2 Web service Using Maven Project .

Creating Project Structure

create new maven project name OrderProcessClient.

groupId : org.wso2.carbon
artifactId : OrderProcessClient
version : 1.0.0

Include following configuration to the pom.xml


pom.xml

Start the axis2 server that start in previous tutorial.
Download wsdl file of the service in to project Resource folder by going to the OrderProcessService link and build the project.
From this Step Service Stub class of the Service is generated in the org.wso2.service package.

Writing Client Code by Use of Service Stub Class

Create OrderProcessClient class in org.wso2.client folder
OrderProcessingClient.java
Finally you can run this class and check the functionality of your service.





Wednesday, March 18, 2015

How to Create Axis2 Web service Using Maven Project

Introduction

The Apache Axis2 is a Java-based implementation of both the client and server side of the web service. Apache Axis2 provides a complete object model and a modular architecture that makes it eas to add functionality and support for new web service related specifications and recommendations.

Prerequisite


1. Axis2 Server ( you can download from here ) .

2. Intelij Idea  ( you can download it from here ) .

3. Maven (you can download it from here ).

Creating the project Structure


create new maven project name OrderProcessWS.

groupId : org.wso2.carbon
artifactId : OrderProcess
version : 1.0.0

Include following configuration to the pom.xml

Package Creation


Create org.wso2.data and org.wso2.service packages
org.wso2.data -this package contains DAO classes need for web Service.
org.wso2.service - this package contains the operations related to the service

Writing Classes


Create Item and OrderDetail classes in org.wso2.data package

Item.java


OrderDetail.java

create ProcessOrders class in org.wso2.service package
ProcessOrders.java

Writing Services.xml

services.xml contains the details of the service that we exposed . This configuration file have to create inside the src/main/resources/META-INF folder

services.xml

name :  The service name will be the name of the archive file if the .aar file contains only one service, or else the name of the service will be the name given by the name attribute.

scope :  (Optional Attribute) The time period during which runtime information of the deployed services will be available. Scope is of several types- "application", "soapsession", "transportsession", "request". The default value (if you don't enter any value) will be "request"

class :  (Optional attribute) The full qualified name of the service lifecycle implementation class. ServiceLifeCycle class is useful when you want to do some tasks when the system starts and when it shuts down.

Description :  (Optional) If you want to display any description about the service via Axis2 web-admin module, then the description can be specified here.
For more information go here.

Finally build the maven project and copy  OrderProcessService.aar file inside the project target into <Axis2_HOME>/repository/services and start the axis2 server.
you can find the wsdl represenation of the soap service by browse
http://localhost:8080 and select the OrderProcessService from
deployed services list.