Thursday, March 4, 2010

Creating a MySQL database for WSO2 Carbon 3.x.x products

WSO2 Carbon products have an inbuilt H2 database. Additionally the Carbon framework allows you to switch to the databases such as Oracle, MSSQL,MySQL, Derby, DB2.

You can easily switch between these databases by;
- creating a database schema within the relevant RDBMS
- point the configuration scripts to that db
- copy the drivers
- start the server with -Dsetup
I will describe these steps in a separate post.

This post is about how you can manually configure the database. I will be using MySql in my illustration. And I will be using WSO2 Identity Server 3.0 -alpha releases for this.


Creating MySQL database for WSO2 Carbon
-----------------------------------------------------------------

1. Download a wso2 identity server 3.0 alpha release

2. Navigate to the location where you have the mysql script. i.e. CARBON_HOME/dbscripts

3. Open a command prompt from that location and login to mysql from cmd prompt
mysql -u root -p

4. Create a database. Create user and grant access
create database regdb;
GRANT ALL ON regdb.* TO regadmin@localhost IDENTIFIED BY "regadmin";

6. Run the mysql.sql script. This will configure the database.
use regdb;
source mysql.sql


7. Copy the database driver to CARBON_HOME\repository\components\lib. I used mysql-connector-java-5.1.7-bin.jar, which is the official JDBC driver for MySQL. It can be downloaded from here.



8. Configure usermanager and registry scripts, which reside in CARBON_HOME/repository/conf

registry.xml
<currentDBConfig>mysql-db</currentDBConfig>
        <dbConfig name="mysql-db">
            <url>jdbc:mysql://localhost:3306/regdb</url>
            <userName>regadmin</userName>
            <password>regadmin</password>
            <driverName>com.mysql.jdbc.Driver</driverName>
            <maxActive>80</maxActive>
            <maxWait>6000</maxWait>
            <minIdle>5</minIdle>
       </dbConfig>

user-mgt.xml
<Database>
         <URL>jdbc:mysql://localhost:3306/regdb</URL>
         <UserName>regadmin</UserName>
         <Password>regadmin</Password>
         <Dialect>mysql</Dialect>
         <Driver>com.mysql.jdbc.Driver</Driver>
    </Database>

Monday, February 15, 2010

Agile or waterfall?

Here's a short video which explains the difference between agile and waterfall models.

Monday, February 8, 2010

Accessing a datafile through Selenium RC

In our testing most of us require to call data from a data storage and execute our tests to confirm various validations work as expected, different conditions are met etc.

Below is a code snippet that I used in calling data used in a .txt file in validating a simple test in user name password based sign-in process. I was on Selenium RC/JUnit/Java platform in this.

public class SignIn extends SeleneseTestCase {

public void setUp() throws Exception {
   setUp("https://localhost:9443/carbon/", "*chrome");
}

   public void testSignInValdation() throws Exception {
       BufferedReader in = null;
       InputStreamReader inputStream = null;

       inputStream = new InputStreamReader(new FileInputStream("C:" + File.separator + "signin.txt"));
       in = new BufferedReader(inputStream);
       String line = null;

       while ((line = in.readLine()) != null) {
            System.out.println("password: " + line);
            selenium.open("/carbon/admin/login.jsp");
            selenium.waitForPageToLoad("30000");
            selenium.type("txtUserName", "yumani");
            selenium.type("txtPassword", line);
            selenium.click("//input[@value='Sign-in']");
            selenium.waitForPageToLoad("30000");
       }
   }
}

Thursday, February 4, 2010

Deploying WSO2 Carbon 2.0.x in IBM WebSphere Application Server 6.1

PLEASE NOTE: THIS FEATURE IS DISCOURAGED AND DEPRECATED IN LATEST CARBON PLATFORM (WSO2 CARBON 4.0.0).

I have converted one of the past blog posts into an article and its now published in WSO2 Oxygen Tank -Library.

Its titled as "Deploying WSO2 Carbon 2.0.x in IBM WebSphere Application Server 6.1". Is available here.

Tuesday, February 2, 2010

Cloud and open source meet to test Web apps

Start-up Sauce Labs receives funding to support open-source Selenium project on-premise and in the cloud.

Blog post by Dave Rosenberg on Software, Interrupted.
http://news.cnet.com/8301-13846_3-10437699-62.html

Tuesday, October 20, 2009

SOA Workshop in Santa Clara - Nov 3rd 2009




Who should attend this workshop?
Enterprise IT Architects
Software Developers


When?
November 3rd 2009 - 9:00 am to 5:00 pm
(Registration at 8:30 am) 


What is the cost?
$75 per person

Where?
Network Meeting Center at Techmart
5201 Great America Parkway
Santa Clara, California 95054



What will I learn?

 Everything you want to know on implementing real world SAO solutions!
 More details - http://wso2.com/events/2009-us-soa-workshop/

New release of WSO2 product family !!!!

Its been a little more than a week now. But I need to make a note of it. WSO2 released new versions of five of its products on 09th Oct.

It include;
WSO2 WSAS 3.1.1
WSO2 Governance Registry 3.0.1
WSO2 ESB 2.1.1
WSO2 IS 2.0.1
WSO2 Mashup Server 2.0.0

The release notes of Mashup Server and Identity Server (the ones that I talk about most) are given below.

WSO2 Identity Server 2.0.1
The WSO2 Identity Server team is pleased to announce the release of version 2.0.1 of the Open Source WSO2 Identity Server (IS).

IS 2.0.1 release is available for download at [1].

This is based on revolutionary the WSO2 Carbon [2] framework, Middleware a la carte'.

All the major features have been developed as pluggable Carbon components.

New Features
-------------------
1. SAML 2.0 Token Profile support
2. Passive STS
3. Equinox P2 based provisioning support
4. Improved Support for deploying on top of WebSphere, WebLogic, and JBoss.
5. Various bug fixes and enhancements including architectural improvements to Apache Axis2, Apache Rampart, Apache Sandesha2, WSO2 Carbon and other projects

Other Key Features
---------------------------
1. Entitlement Engine with XACML 2.0 support.
2. Claim based Security Token Service.
3. Extension points for SAML assertion handling.
4. OpenID Provider
5. Information Card Provider

How to Run
-------------
1. Extract the downloaded zip.
2. Go to the bin directory in the extracted folder.
3. Run the wso2server.sh or wso2server.bat as appropriate.
4. Point your browser to the URL https://localhost:9443/carbon
5. Use "admin", "admin" as the user name and password.
6. If you need to start the OSGi console with the server use the property -DosgiConsole when starting the server

Known issues
---------------
All the known issues have been filed here [3]. Please report any other issues you find as JIRA entries.

Contact us
-----------
WSO2 Identity Server developers can be contacted via the mailing lists:
For Users: carbon-user@wso2.org
For Developers: carbon-dev@wso2.org

Alternatively, questions can also be raised in the Identity Server forum at http://wso2.org/forum/308

Training
---------
WSO2 Inc. offers a variety of professional Training Programs, including training on general Web services as well as WSO2 Identity Server,Apache Axis2, Data Services and a number of other products. For
additional support information please refer to http://wso2.com/training/course-catalog/


Support
--------
WSO2 Inc. offers a variety of development and production support
programs, ranging from Web-based support up through normal business
hours, to premium 24x7 phone support. For additional support information
please refer to http://wso2.com/support/


For more information on WSO2 Identity Server, visit the WSO2 Oxygen Tank[4].

Thank you for your interest in WSO2 Identity Server.

-The WSO2 Identity Server team

[1]: http://wso2.org/downloads/identity
[2]: http://wso2.org/projects/carbon
[3]: https://wso2.org/jira/browse/CARBON
[4]: http://wso2.org


WSO2 Mashup Server 2.0.0


The WSO2 Mashup Server team is pleased to announce the release of version 2.0.0 of the Open Source WSO2 Mashup Server.

Downloads are available at http://wso2.org/downloads/mashup

For a complete list of project resources including SVN, Mailing lists, Forums, JIRA and Tutorials visit http://wso2.org/projects/mashup

"Create, deploy, and consume Web services Mashups in the simplest fashion."

The WSO2 Mashup Server is a powerful yet simple and quick way to tailor Web-based information to the personal needs of individuals and organizations. It is a platform for acquiring data from a variety of sources including Web Services, HTML pages, feeds and data sources, and process and combine it with other data using JavaScript with E4X XML extensions. The result is then exposed as a new Web service with rich metadata and artifacts to simplify the creation of rich user interfaces


Key Features
---------------
* Hosting of mashup services written using JavaScript with E4X XML extension
    - Simple file based deployment model
* JavaScript annotations to configure the deployed services
* Auto generation of metadata and runtime resources for the deployed mashups
    - JavaScript stubs that simplify client access to the mashup service
    - Code templates for developing rich HTML or Google Gadget interfaces
    - TryIt functionality to invoke the mashup service through a web browser
    - WSDL 1.1/WSDL 2.0/XSD documents to describe the mashup service
    - API documentation
* Ability to bundle a custom user interface for the mashups
* Many useful Javascript Host objects that can be used when writing mashups
    - WSRequest: invoke Web services from mashup services
    - File: File storage/manipulation functionality
    - System: Set of system specific utility functions
    - Session: Ability to share objects across different service invocations
    - Scraper: Extract data from HTML pages and present in XML format
    - APPClient: Atom Publishing Protocol client to retrieve/publish Atom
                 feeds with APP servers
    - Feed: A generic set of host objects to transparently read and create
            Atom and RSS feeds
    - Request: Ability get information regarding a request received
* Support for recurring and longer-running tasks
* Support for service lifecycles
* Ability to secure hosted mashups using a set of commonly used security scenarios
* Management console to easily manage the mashups


New Features In This Release
------------------------------
The 2.0 version of the Mashup Server is built on top of the Award Winning WSO2 Carbon Platform. All the major features have been developed as pluggable Carbon components.


Installation & Running
-----------------------
1. extract the downloaded zip file
2. Run the wso2server.sh or wso2server.bat file in the bin directory
3. Once the server starts, point your Web browser to
   https://localhost:9443/carbon/

For more details, see the Installation Guide


System Requirements
----------------------
1. Minimum memory - 256MB
2. Processor      - Pentium 800MHz or equivalent at minimum
3. The Management Console requires full Javascript enablement of the Web browser
   NOTE: On Windows Server 2003, it is not allowed to go below the medium security level in Internet Explorer 6.x.

For more details see
http://wso2.org/wiki/display/carbon/System+Requirements


WSO2 Mashup Server Binary Distribution Directory Structure
---------------------------------------------------------------
  CARBON_HOME  
       |-bin      
       |-conf   
       |-database
       |-dbscripts
       |-docs     
       |-lib      
       |-logs
       |-repository     
       |---dataservices            
       |---scripts      
       |---services
       |-resources      
       |---security
       |-tmp      
       |-webapps      
       |-- LICENSE.txt
        |-- README.txt
        |-- INSTALL.txt
        |-- release-notes.html
   

   - bin
      Contains various scripts .sh & .bat scripts

    - conf
      Contains configuration files

   - database
     Contains the database

    - lib
      Contains the basic set of libraries required to startup WSO2 Mashup Server in standalone mode

    - logs
      Contains all log files created during execution

    - repository
      The repository where Carbon artifacts & Axis2 services and modules deployed in WSO2 Mashup Server are stored. In addition to this other custom deployers such as javascript, dataservices, axis1services and pojoservices are also stored.
     
            - dataservices
              Contains the Data Services hosted in the Mashup Server.
             
            - scripts
              Contains the Javascript Services (Mashups) hosted in the Mashup Server.
             
            - services
              Contains the Java Services hosted in the Mashup Server.

    - resources
      Contains additional resources that may be required

    - tmp
      Used for storing temporary files, and is pointed to by the java.io.tmpdir System property

    - webapps
      Contains the WSO2 Mashup Server webapp. Any other webapp also can be deployed in this directory

    - LICENSE.txt
      Apache License 2.0 under which WSO2 Mashup Server is distributed.

    - README.txt
      This document.

    - INSTALL.txt
          This document will contain information on installing WSO2 Mashup Server

    - release-notes.html
      Release information for WSO2 Mashup Server 2.0


Training
---------
WSO2 Inc. offers a variety of professional Training Programs, including training on general Web services as well as WSO2 Mashup Server, Apache Axis2, Data Services and a number of other products.

For additional support information please refer to http://wso2.com/training/course-catalog/


Support
---------
WSO2 Inc. offers a variety of development and production support programs, ranging from Web-based support up through normal business hours, to premium 24x7 phone support.

For additional support information please refer to http://wso2.com/support/

For more information on WSO2 Mashup Server, visit the WSO2 Oxygen Tank (http://wso2.org)


Enjoy the WSO2 Mashup Server,

The WSO2 Mashup Server Team ~~~~

Tuesday, September 22, 2009

Invoking Web services using stubs

I've been using Keith's tutorial on "Invoking Web Services from a Mashup" when testing the stub generating and use of generated stub features in WSO2 Mashup Server.

This note is an elaborated version of stubs part of that article, containing the same information in a more detail manner where a less-techy person like me can follow effortlessly.


Why do you need a stub :
Stub is used to generate the soap message for us to send the request and recieve the response over the wire.
It is a Java class that is statically bound to a service endpoint interface. A stub, or a client proxy object, defines all the methods that the service endpoint interface defines. Therefore, the client can invoke methods of a web service directly via the stub. The advantage of this is that it is simple and easy to code. The disadvantage is that the slightest change of web service definition lead to the stub being useless... and this means the stub must be regenerated. It is advisable to use the static stub technique if you know that the web service is stable and is not going to change its definition. Static stub is tied to the implementation. In other words, it is implementation-specific.



Invoking an external service in asynchronous manner
----------------------------------------------------------------------

I'll be invoking a service residing externally in http://www.webservicex.net. WSDL url of this is http://www.webservicex.net/CurrencyConvertor.asmx?WSDL.


1. Go to stubs generator in WSO2 Mashup Server 2.0.0 and select to generate an E4X stub for the above wsdl.




2. Copy and paste this stub to a note pad.

3. Deploy the following service in the Mashup Server.

system.include("currencyConvertorStub.js"); 

convertionRateUsingStub.inputTypes={"fromCurrency" : "string", "toCurrency" : "string"}; 
convertionRateUsingStub.outputType="string"; 
function convertionRateUsingStub(fromCurrency, toCurrency){ 
var rate =  CurrencyConvertor.ConversionRate(fromCurrency, toCurrency); 
return "The conversion rate is " + rate; 
}

4. When a service is deployed in the mashup server a folder with the syntax 'servicename.resources' will be created in the MASHUP_HOME/repository/scripts folder.
So if our service above was deployed as "CurrenctConversion.js", there will be a folder called "CurrenctConversion.resources".


5. Now go to the stub that you pasted in to a note pad, save it in MASHUP_HOME/repository/scripts/CurrenctConversion.resources as "currencyConvertorStub.js"

6. Access the tryit of "CurrenctConversion" javascripts service.

7. It'll be doing the currency coversion using the stub generated from the WSDL. ????/



Invoking an external service in synchronous manner
----------------------------------------------------------------------

I'll be invoking the same service using http://www.webservicex.net/CurrencyConvertor.asmx?WSDL.

1. Go to stubs generator in WSO2 Mashup Server and select to generate an E4X stub for the above service.

2. Copy and paste this stub to a note pad.


3. Deploy the following service in the Mashup Server.

system.include("currencyConvertorStub.js");

convertionRateUsingStubAsync.inputTypes={"fromCurrency" : "string", "toCurrency" : "string"};
convertionRateUsingStubAsync.outputType="string";
function convertionRateUsingStubAsync(fromCurrency, toCurrency){
CurrencyConvertor.ConversionRate.callback = success;
CurrencyConvertor.ConversionRate.onError = failure;
CurrencyConvertor.ConversionRate(fromCurrency, toCurrency);
return "Invoked the ConversionRate operation in a async manner";
}

success.visible=false;
function success(ConversionRateResponse) {
system.log("The response of ConversionRate was : " + ConversionRateResponse);
}

failure.visible=false;
function failure(error) {
system.log("Error occured while calling ConversionRate, Reason is : " + error.reason);
}


4. When a service is deployed in the mashup server a folder with the syntax 'servicename.resources' will be created in the MASHUP_HOME/repository/scripts folder.
So if our service above was deployed as "CurrenctConversion_sync.js", there will be a folder called "CurrenctConversion_sync.resources".


5. Now go to the stub that you pasted in to a note pad, save it in MASHUP_HOME/repository/scripts/CurrenctConversion.resources as "currencyConvertorStub.js"


6. Access the tryit of "CurrenctConversion_sync" javascripts service.




Invoking a service secured using Username Token authentication
-----------------------------------------------------------------------------------------

1. Sign-in to MS console.

2. Create a service (usernameTokenService.js) using the source below ;

demo.inputTypes={"firstParam" : "string" , "secondParam" : "string"};
demo.outputType="string";
function demo(firstParam, secondParam){
return "user " + request.authenticatedUser + " called the demo function with params " + firstParam + " and " + secondParam;
}

3. Secure the service with Username Token
This can be done from Manage > Services > List > [ServiceName] > Service Dashboard > Security

4. Create another service (invokeSecuredService.js) using the source below;

system.include("usernameTokenServiceStub.js");

invokeSecuredService.inputTypes={"firstParam" : "string" , "secondParam" : "string"};
invokeSecuredService.outputType="string";
function invokeSecuredService(firstParam, secondParam) {
usernameTokenService.username = "yourUsername";
usernameTokenService.password = "yourPassword";
return usernameTokenService.demo(firstParam, secondParam);
}

5. Generate the stub for "usernameTokenService" service and save it as usernameTokenServiceStub.js



6. Copy it to the .resource folder of the "invokeSecuredService" service we created in step 4

7. tryit? the second service (invokeSecuredService).

Monday, September 14, 2009

Using Yahoo Messenger in WSO2 Mashup Server 2.0.1

Since the 1.x.x versions of WSO2 Mashup Server, it provided the capability to add instant messaging to the java script mashup services you write using the programming environment available within the server.

Instant Messaging capability was provided via IM host object. This supports different IM protcols such as MSN, Yahoo, ICQ, Jabber, AIM.

When using Yahoo protocol, we have to download the ymsg (Yahoo Instant Messager and Chat protocols) library.

UNTIL 2.x.x versions, we used to copy these into MASHUP_HOME/lib folder.

Now IN 2.x.x versions, after mashup server is carbonized, this is changed. In WSO2 Mashup Server 2.0.1 which will be released soon, the ysmg jars needs to be copied to MASHUP_HOME/repository/components/lib. The jars will be downloaded as a .zip where 3 jars files are bundled in it. So you need to extract it and copy the jars in to the WSO2 Mashup Server.

Tuesday, September 8, 2009

How to deploy WSO2 Identity Server in IBM WebSphere Application Server 6.1

PLEASE NOTE: THIS FEATURE IS DISCOURAGED AND DEPRECATED IN LATEST CARBON PLATFORM (WSO2 CARBON 4.0.0).

In this blog post I'll be putting together a deployment cheat-sheet for deploying WSO2 Identity Server 2.0.1 in IBM WebSphere Application Server 6.1.

In summary this deployment involves;
- Downloading IBM WebSphere Application Server 6.1, create a profile
- Downloading WSO2 Identity Server 2.0.1, and configuring it.
- Configuring IBM WAS


Lets move on to details...

1) Download an install WAS
Download the WebSphere Application Server from this location and install by executing .exe setup in your local machine.

a) From the start menu go to All Programs > IBM WebSphere > Application Server V6.1 > Profile Management Tool.
b) In the 'Profile Management Tool' accept defaults until you select a 'Typical Profile Creation' as profile creation options and then give user name\password for your profile.
c) The last step of the profile creation will show you a summary of the


2) Create a Profile
After installing create a profile using the 'Profile Management Tool' note down the http\https ports from this. In my case its 9081\9444.


3) Download WSO2 Identity Server 2.0.1.
Download WSO2 IS 2.0.1 from here. Extract it to a location in your file system.


4) Create a war file
a) In the file system create a folder with .war extension. (e.g. is.war)
b) Copy IS_HOME\webapps\ROOT\WEB-INF folder into this.
c) Open command promt within is.war
d) Type jar -cvf is.war *


5) Create a repo in your file system.
From the WSO2 IS distribution, copy the following folders in to 'WAS_repo'.
- IS_HOME\conf
- IS_HOME\database
- IS_HOME\repositoy
- IS_HOME\resources


6) Change the address and path details in configuration files as below;
a) WAS_repo\conf\axis2.xml;
Change HTTP and HTTPS ports within In Transports to 9081 and 9444.
<transportReceiver name="http" class="org.wso2.carbon.core.transports.http.HttpTransportListener">
<parameter name="port">9081</transportReceiver>

<transportReceiver name="https" class="org.wso2.carbon.core.transports.http.HttpsTransportListener">
<parameter name="port">9444</transportReceiver>



b) WAS_repo\conf\carbon.xml
Make to /is and change to contain the WAS port and the context.
<WebContextRoot>/is</WebContextRoot>
<ServerURL>https://localhost:9444/is/services/</ServerURL>


c) WAS_repo\conf\registry.xml
Update the path to h2 database to the database folder within the WAS_repo
<URL>jdbc:h2:D:/Testing/IS/2.0.1/WAS_repo/database/WSO2CARBON_DB</URL>

d) WAS_repo\conf\user-mgt.xml
Update the path to h2 database to the database folder within the WAS_repo

e) WAS_repo\conf\identity.xml
Update to contain the WAS port and the context.

<OpenIDServerUrl>https://localhost:9444/is/openidserver</OpenIDServerUrl>
<OpenIDUserPattern>https://localhost:9444/is/openid/</OpenIDUserPattern>


7) Start WAS
a) From a command prompt go to WAS_HOME/profiles/AppSvr02/bin.
b) set CARBON_HOME to the WAS_repo we created above
c) type startServer.bat server1 to start the server


8) Configure WAS
a) Open WAS admin console from a browser (e.g. https://localhost:9044/ibm/console/logon.jsp)
b) Go to Security > SSL certificate and key management > Key stores and certificates > New
c) Give the name, path and password for the keystore files. For WSO2 IS you can use the details below.

name = anything (I'll put wso2carbon_cert)
path = CARBON_HOME\resources\security\wso2carbon.jks (CARBON_HOME is the location of the 'WAS-repo' we created).
password = wso2carbon
type = jks

d) Go to Applications > Install New Application.
e) Give the path and the context root for the application. In our case;

path = path to the is.war we created
context root = /is

f) Go to Applications > Enterprise Applications
g) Select the is_war that we deployed just now. Press 'start'.


9) Restart IBM Websphere Application Server by setting CARBON_HOME environment variable as before.

So now we are ready to access WSO2 Identity Server from IBM Websphere Application Server.


10) Open up a browser and type https://localhost:9444/is/carbon.

Thursday, July 9, 2009

Front-End Back-End seperation - WSO2 IS 2.0

This is a simple note on how to separate front-end and back-end of WSO2 IS.

1. First we need to download the WSO2 IS 2.0 binary distribution and extract it to two locations in your file system.

2. Then change the configuration files in WSO2_IS_HOME\conf directory as given below.


3. Lastly before you start the servers;
- In the FE -> Delete the 'server' folder in WSO2_IS_HOMEwebapps\ROOT\WEB-INF\plugins
- In the BE -> Delete the 'console' folder in WSO2_IS_HOMEwebapps\ROOT\WEB-INF\plugins

Featured

Selenium - Page Object Model and Action Methods

  How we change this code to PageObjectModel and action classes. 1 2 3 driver . findElement ( By . id ( "userEmail" )). sendKeys (...

Popular Posts