Wednesday, September 1, 2010

Creating a WSO2 artifact using Eclipse

As was shown in my previous article, we have a plugin which can be added to eclipse which will open you a development environment to create artefacts used in WSO2 products. Now lets see how we can create WSO2 product artefacts in this environment.

So to start off with, you need to have eclipse IDE, (preferably, eclipse-jee-galileo) and install WSO2 cApp following the steps in here.

After WSO2 cApp is installed and the IDE is restarted, do following;

1. Create a WSO2 project
Go to File > New > Project. This will open up the 'New Project' wizard.
You have two menu options for this:
  • You can either select 'Carbon Application Project' option that appear at the beginning of the list.
  • Or you can select 'WSO2' at the bottom, which will also give 'Carbon Application Project' when you expand it.

In the next step, give your project a name and 'finish' the wizard.

Now you'll have a project created (with the name you gave) in the 'Project Explore'. Expand the project folder and you'll find its initial content as shown below;
  • JRE System library - Jars from your java runtime
  • java-src -the place where you keep the java src files
  • Artifacts - you will have this empty when you start. Later when you create an artifact, it will appear inside this.
  • root-artifact.xml - Is the place which manages you project
  • Server Roles - Server roles that you can specify for each of your artefact.

2. Create an artifact
Double click on root-artifact.xml. Click on 'Create New Artifact' button. You will get a drop down menu, which will have all WSO2 artifacts that are supported up to now.

From the menu simply select the artifact you need to create.

I will explain how to create few ESB artefacts in my next posts.
Enhanced by Zemanta

Friday, July 16, 2010

How to install WSO2 cApp in eclipse

Am using eclipse-jee-galileo-linux-gtk.tar.gz for this. and a milestone release of WSO2 cApp plugin, which can be downloaded from here.

1. Firstly extract you eclipse distribution and launch it.

2. Then Go to Help menu and select "Install Software"


3. Click on the 'Add' button at the top corner of the 'Install' DBox to add the location where the software resides.




4. In the 'Add site' DBox, click on 'Archive' button and navigate to the location where you downloaded WSO2 cApp plugin (wso2-eclipse-ide-tools-1.0.0.M11.zip).

5. When the achive is added, all the software available in it will appear in the small text area below it.
Remember : You need to have "group items by category" checkbox unchecked.



4. Out of the above list, select "WSO2 Carbon Studio Feature" and press Next to proceed and move on until completion.

That's it. Now you have WSO2 cApp integrated to eclipse IDE.

Sunday, June 13, 2010

WSO2 Stratos, the first 100% open source cloud platform for enterprise applications

“At a time when IT developers can create a new application in one month, taking months to provision and deploy servers and systems no longer makes strategic or economic sense,” said Dr. Sanjiva Weerawarana, WSO2 founder and CEO.

Read on @ http://www.itpro.lk/node/6962

Wednesday, June 9, 2010

Testing Cloud Services

WSO2 Stratos is a comprehensive, powerful PaaS solution which, WSO2 released newly. It is based on revolutionary Carbon platform and is a self-serving, multi-tenant, elastic runtime for private and public cloud infrastructures.

In this new deployment, Stratos has enabled WSO2 products as services. With it whole WSO2 middle-ware platform is available in the cloud as services.

So how was these services tested. As Paul has mentioned in one of his blog posts (Cloud Native), there are a set of technical attributes that the team take account of, to work well in a cloud environment. Out of these, Mutlitanency and Self servicing abilities were tested with more emphasis in this alpha release.


Self Servicing
Self-service means creating and managing your own tenant in the Stratos application. With this one could register his own organization (tenant) and manage the services, users within it.

How you do this:

1. Access Stratos from https://cloud.wso2.com/ and you will have Stratos Manager who is the entry point to wso2 cloud services.
2. Register a tenant in Startos Manager by going through the registration process that is available there in main page. This is a very simple process where you are asked to give only the domain name, administrator's credentials and security captcha.

After a successful registration, you can sign-in to Stratos using the admin account which would be admin_name@domainname. For an example, if I have my domain as 'ranaweera.lk' and administrator as 'admin', I can sign-in as 'admin@ranaweera.lk'

So that's about registering. This initial user is called the tenant-admin. After registering the organization, the tenant-admin can;
 - create users within it,
 - create various roles and assign users to them,
 - enable\disable services.

Tenant-users can;
- login and access the enabled cloud services,
- deploy there own web services,
- deploy mashups,
- apply security, change policies, apply throttling, engage modules etc to these services.

Few illustrative cases on this are;




Managing users:
From Stratos Manager, if you access 'Users & Roles' option, it allows you to add new users and roles in addition to existing admin user and role. While adding roles you can select the set of permissions you need to assign to a certain role. A user can be assigned one or many roles and vice versa. This is similar to the user management functionality we already have in all WSO2 products.



These users who were added above, are called 'tenant users'. A tenant user can login to 'Stratos Manager' from https://cloud.wso2.com/.  The user credentials that the admin assigned at the time the user was created must be used here. After signing-in to Stratos Manager, he will see all the cloud services that the tenant-admin has enabled for the tenant.




He then can sign-in to the cloud services using the same credentials.


Theming:
The tenant admin also can update the theme of his tenant by going to 'Theme' menu. There are few default themes as well as a 'customize' option.

A theme  that is applied at the Cloud Manager level should be propagate to all the cloud services within that tenant.




Billing:

This feature lets the billing information for the tenant viewable by the admin role. This component is still in development stages, so there'll be more to be said under this in future..


All the above can be done without a third party involvement making it 'self serving'. It is for the tenant administrator to manage with his tenant users.




Multitanancy

Mutlitanancy within Stratos is the ability it provides multiple organizations to register ,  Stratos Manager and work simultaneously, within their own domain. Like in our real world scenarios here the details of one organization should be private and shared only within it.

Lets simulate a step by step procedure of creating this environment;

1. First create a tenant (tenant A) and add users to it.
2. Create another tenant (tenat B) and add user to it too.
The tenant admin and users of tenant A could only access\view\edit services within their tenant. The admin and tenant users in tenant B are totally blind about the existent of tenant A.

We can use this environment to run through scenarios such as below;

Multitanancy in mashups (js services):
If the Cloud Mashup Sever was enabled as a service and tenant admin sign-in to it. He can create a javascript service in it. Lets say our admin has created a service which scrapes updates from a site and sends emails to a set of recipients. This service should be available for other tenant users to view and use. They should be able to edit it depending on the permissions granted by the admin. This mashup should appear in the service list with the author's name.



Now if you sign-in to tenant-B. Neither the admin nor the users of tenant B can access or see the services created by tenant A users. Because the two domains are two seperate entities.
Of course there are a set of system samples which will be available for all users by default. These are deployed under 'system' user.


Multitanancy in task-scheduling:

If a user\admin from a tenant schedule a task, (This is available in Cloud Mashup Server, from Configure > Scheduled Tasks menu), it will be visible and operational only within the tenant which originated it.


Multitanancy in gadgets:

In the Cloud Gadget, it allows the users to add gadgets of their desire. It lets him design their own gadget environment by adding\editing\deleting new tabs, new gadgets in their environment. All these customization done by a user (may it be the tenant user or tenant admin) is strictly for that particular user's account.

And, also these settings are not shared among tenants!

Cloud Gadget also lets you a community feature which facilitates gadgets' rating and commenting. A comment or a rating submitted by one tenant user can be viewable by other tenant users. But they are not shared with another tenant.

There's also a feature which gives you an update on the number of users who are using a particular gadget at a given time. This count is based on the users who use the gadget within a given tenant. It is not shared among tenants.



Mutlitenancy in entitlement policies:
You can create entitlement policies by going to Cloud Identity. These policies that you create in your tenant will be used only within it. And yes, these xcml policies can be used among the could services you have within your tenant.

For an example you should be able to do what is said in here.


Multitenancy in keystores/relying parties:

Again, Cloud Identity lets you store your relying party certificates and keystores. Similar to other scenarios these also tenant specific and blind to other tenants.



Likewise there's more and more scenarios you get to exercise and of course 'apply' in real world using WSO2 Stratos, which has whole of WSO2 middleware platform available in a single environment as services. Instead of having several servers started separately, here you have all the servers available at once. You can intercommunicate with them much easily.

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).

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