Friday, December 26, 2014

Write a Simple BPEL Project with WSO2 Developer Studio and Deploy it in WSO2 BPS


Prerequisites:


Create New Server Runtime Environment for Apache ODE

1. Copy the ode.war to apache-tomcat-7.0.47/webapps directory and start the server. when you see the ode directory created under apache-tomcat-7.0.47/webapps directory, stop the server.

2. Configure the server runtime as follows:

Create BPEL Project
 1. Create a new BPEL project as follows:

2. In the next dialog, provide a project name and select the target runtime as Apache ODE. Click Finish.

3. Write click on the project and create a "New BPEL process file" (Same as step 1). Fill the dialog accordingly and make sure you select the Template to 'Synchronous BPEL Process' and click finish.


4. Copy the Hello.wsdl file inside bpelContent folder in Eclipse project.
Sample Hello.wsdl is attached.

5. Open the .bpel file design view. You should be able to see the Palette in the workspace with all the gadgets required to create the BPEL workflow.

6. Drag and drop two Assign actions and an Invoke action as follows:

7. Click on Invoke and rename it to 'invokeHelloService'

8. In the Properties Dialog, click on 'Details' tab.

9. Select 'Create Global Partner link' from Partner Link drop down. A popup will Open.

Provide a 'Partner Link Name' (any meaningful name is sufficient) and click Ok. Choose 'HelloPortType' as depicted below and click Ok.

Provide a 'Partner Link Type Name' (any meaningful name is sufficient) and click Next. Give a 'Role Name' and click Finish.

10. Under the Properties dialog there is a 'Quick Pick section'.
Select 'greetingInSinhala' from that and double click on it.
You will noticed that the Input/Output variables are generated as follows. Save the changes made.


 11. Now it is time to pass the input parameters to the Hello service. In order to do that we have to click on 'Assign' action. In Properties dialog click on 'Details' tab.

12. Click on New and do as depicted below and hit Save. You will be prompted for Initializer dialog. Click yes.
 Here you will assign the input for the Hello Webservice from BPEL input payload.


13. Likewise in 'Assign1' action do the same as follows and hit Save.You will be prompted for Initializer dialog. Click yes.
 Here you will assign the output received from Hello Webservice to BPEL output payload.

 14. Write click on the project and create new  'Apache ODE Deployment Descriptor'. Do the configuration as follows:


15. Create a ZIP archive as follows:


Now the BPEL is ready.

Deply BPEL Project in WSO2 BPS
1. Start the WSO2 BPS and access the carbon console (https://1localhost:9443/carbon/). Login as admin user with admin/admin credentials.

2. Under 'Manage' section click on 'Processes' -> 'Add'. Upload the Zip.

3. Now you can see the uploaded BPEL under 'Processes' -> 'List'.

4. Click on the 'Process ID'. You will see a dialog simillar to below:


5. Use try it and you will get a response as follows:


That is it. Happy Orchestration with BPEL :)

How to convert a simple Java class to a Webservice with Axis2 [Deploying POJOs]

It has never been this easy to convert your class into a Webservice in few steps with Apache Axis2.
Apache Axis2 is a SOAP processing engine and it is hand in hand with WSO2 SOA middleware platform.

Prerequsists:

JDK 1.7/1.6


How to create Axis2 service
1. Create a new Axis2 service project in Eclipse

2. Tick 'Create new Axis2 Service ' and click Next
3. Provide Project Name, package name and Class name and click Finish.




As you can see the project structure will contain the services.xml file which contains the details of the exposed service.

4. Now you can add methods to the Class as follows:

package com.world.hello;

public class Hello{

   
    public String greetInSinhala(String name){
        return "Ayubowan "+ name;
    }
   
    public String greetInEnglish(String name){
        return "Hello "+ name;
    }
}


4. Now you can add methods to the Class as follows:
5. Now create the service archive file (*.aar extension) by right click on the project and select 'Export Project as Deployable Archive'.

 How to deploy *.aar file in Axis2 enabled Tomcat 
 1. Copy the axis2 war file to apache-tomcat-7.0.47/webapps directory and start the server.
You will see the axis2 directory under Tomcat webapps directory once the server is started.
2.Copy the HelloWorld.aar file to apache-tomcat-7.0.47/webapps/axis2/WEB-INF/services directory
3. Access below url and you should be able to see the deployed service and the available methods.

http://localhost:8080/axis2/services/listServices



That is the end of the story :)





Monday, December 22, 2014

SSO session timeouts when the applications are idle for 15 minutes [WSO2 IS 5.0.0]

In IS 5.0.0 there is a session cache which gets cleared every 15 minutes and it is not configurable at the moment.
But there is a workaround.
You have to enable remember me while sign-in to the system. Then even if the cache expires in 15 minutes, the session cookie will be retrieved from session data persistence. But this will keep your login active even if you close the browser and reopen it.
You can get rid of that by setting the "RememberMePeriod" under "SessionDataPersist" to -1 in identity.xml.
So every time you close the browser, you will have to login to the application again.

Tuesday, December 2, 2014

Downgrade Subversion 1.8 to 1.7 in Ubuntu 14.04

I ran into the below problem when I try to update my existing codebase after upgrading the operating system from ubuntu 12.04 to 14.04.

The working copy at '/home/punnadi/wso2/source/platform/turing'
is too old (format 29) to work with client version '1.8.8 (r1568071)' (expects format 31). You need to upgrade the working copy first.

The reason behind this error os Ubuntu 14.04 comes with subversion 1.8.x by default. So I had to downgrade the subversion version to 1.7.x in order to overcome this issue.

I did it with the help of following post (Check the Wauzl's answer).

http://askubuntu.com/questions/453717/i-need-downgrade-from-subversion-1-8-to-subversion-1-7