Wednesday, November 4, 2009

How to configure External Database for WSO2 Business Process Server

WSO2BPS (which allows you to easily deploy and manage complex BPEL services) can be configured to use external database other than the embedded Derby database as it's persistence storage.

Lets configure External database for BPS

1. Set up and start your database server

WSO2BPS (version - 1.1.1) supports for Mysql ,Oracle and MSSQL Database server.  Latest Vesion of WSO2BPS would support for PostgreSQL.


2. Create a database

3. Extract wso2wbps-1.1.1.zip and Load the BPS schema into that database using provided SQL scripts.

(For example if you are using mysql as your database server, use mysql.sql script located inside 'WSO2BPS/dbscripts/bps' directory to create the BPS schema)

use command "mysql -u root -p bps < /home/asela/BPS/wso2bps-1.1.0-SNAPSHO/dbscripts/bps/mysql.sql"
 
4. Create file named 'datasources.properties' inside WSO2BPS/conf directory

5. Add following configuration in datasources.properties file 


Following is sample configuration for Mysql.


synapse.datasources=bpsds
synapse.datasources.icFactory=com.sun.jndi.rmi.registry.RegistryContextFactory
synapse.datasources.providerPort=2199

synapse.datasources.bpsds.registry=JNDI
synapse.datasources.bpsds.type=BasicDataSource
synapse.datasources.bpsds.driverClassName=com.mysql.jdbc.Driver
synapse.datasources.bpsds.url=jdbc:mysql://localhost:3306/bps
synapse.datasources.bpsds.username=root
synapse.datasources.bpsds.password=asela
synapse.datasources.bpsds.dsName=bpsds
synapse.datasources.bpsds.maxActive=100
synapse.datasources.bpsds.maxIdle=20
synapse.datasources.bpsds.maxWait=10000


in first three lines, data source names, initial context factory and provider port have been configured. Here "bpsds"is used as data source name.

other lines are specified the properties for previously created database. Make sure that your database url, username and password are correctly specified.

6.Open bps.xml file inside WSO2BPS/conf directory and add following parameters


7.Copy the JDBC driver jar file into the 'WSO2BPS/repository/components/lib' directory


8.Then start the WSO2BPS server 


if correctly configured You will see following log in WSO2BPS startup..

[2010-05-01 17:49:56,056]  INFO -  DataSources will be registered in the JNDI context with provider PROP_URL : rmi://asela-laptop:2199
.....................................


[2010-05-01 17:49:59,490]  INFO -  ODE using external DataSource "bpsds".
[2010-05-01 17:49:59,491]  INFO -  Using DAO Connection Factory class: org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl
[2010-05-01 17:49:59,491]  INFO -  Using DAO Connection Factory class org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl.
[2010-05-01 17:50:00,701]  INFO -  Registering E4X Extension...
[2010-05-01 17:50:00,761]  INFO -  BPEL Server Started.
[2010-05-01 17:50:00,806]  INFO -  Starting OpenJPA 1.1.0
[2010-05-01 17:50:00,914]  INFO -  Using dictionary class "org.apache.openjpa.jdbc.sql.MySQLDictionary".
 


Tuesday, November 3, 2009

Sample BPEL to ensure the security in External partner service

Resources you need

1.WSO2BPS (which allows you to easily deploy and manage bpel services)
2.WSO2WSAS
3.SecurePartnerBPEL.zip
4.SecurePartnerService.aar
5.sample_keys.zip
6.PWCBHandler.zip

First deploy External partner service in WSO2WSAS and secure it.


1. Extract wso2wsas-3.1.1.zip and run WSAS server.

wso2wsas-3.1.1/bin/wso2server.sh - in unix
wso2wsas-3.1.1/bin/wso2server.bat - in windows

Please refer README file and More details about WSO2WSAS is available at here

2. Upload SecurePartnerService.aar Axis2 service





3. Add new keystore to WSAS


Extract sample_keys.zip and browse to the service.jks

provide following passwords, Key store Password= apache Private Key Password=apache





4. Add new role and user



Add new role called bpsusers

Then add new user

provide username = client, password=apache (these username and password must be in PWCBHandler.jar)

select bpsusers role for client user


5.Go to Service Dashboard of SecurePartnerService and enable security



6. Select any security Scenarios (select service.jks as Trusted Key Stores, Private key store and bpsusers as User Groups)




Then deploy BPEL service in WSO2BPS




1. Extract wso2wbps-1.1.0.zip and copy PWCBHandler.jar to WSO2BPS/repository/components/lib and Extract sample_keys.zip in to WSO2BPS/samples. Then run BPS server.

wso2wsas-3.1.1/bin/wso2server.sh - in unix
wso2wsas-3.1.1/bin/wso2server.bat - in windows

Please refer README file and More details about WSO2BPS is available at here

2.Deploy bpel service in BPS (just click Add BPEL and browse the SecurePartnerBPEL.zip)



3.Under Deployed Services, you can see SecurePartnerBPELServiceService service.


4.Open tcpmon( WSO2BPS/bin/tcpmon.sh) and configure it to monitor the SOAP messages

Listen port=9765 Target port= port of your SecurePartnerService


5.Now try this service using Try it

Enter the security scenario number that is used to secure your External partner service.


Service returns the detail about security scenario that your External partner service is used.




Note = tcpmon can not use for UsernameToken security scenario. According to SecurePartnerBPEL.zip, you must start your External partner service in port=9444. To change http and https port, configure "port" parameter(9763) in your axis2.xml and transport.xml