Articles     Forum     Examples     Download     Open Source

 

PocoCapsule/C++ example: OASIS-OpenCSA Bigbank

Copyright(c) 2006 by Pocomatic Software. All rights reserved.

The OASIS-OpenCSA (Open Composite Services Architecture, formerly known as OpenSOA's Service Component Architecture) is a component model for building applications and systems in Service-Oriented Architecture (SOA).

This BigBank presented here is a well known OASIS-OpenCSA example that is highlighted in official OASIS-OpenCSA documents as well as the prove-of-concept prototype implementation. However, due to its prototype nature and technology limitation, the prototype implementation for C++ applications is intrusive, and business logic component implementations have to be specifically written for the OpenCSA framework (therefore, a technology lock-in) and also tightly coupled with the container's runtime environment. In contrast, the industry strengthen PocoCapsule/C++ is the first and the only non-intrusive OpenCSA container for C++ applications that supports plain old C++ object as OASIS-OpenCSA components.

This example consists of one OpenCSA composite that exports one web service (defined by AccountService.wsdl), uses one external service (defined by StockQuoteWebService.wsdl), and contains the following three components:

Above components are implemented in Components.h and Components.C as plain old C++ objects (POCO). They are wired up by PocoCapsule Container through C++ setter operations of their POCO classes. The wiring assembly description schema/model used in this example is defined in OpenCSA's assembly model 0.96. PocoCapsule also comes with an equivalent but non-OpenCSA version of bigbank example in ${POCOCAPSULE_DIR}/examples/web-services/bigbank-ws directory, that uses a POCO-WebServices assembly model.


Source Files

server.C: This is a simple container, used to setup and assemble the OASIS-OpenCSA composite. It is notable that this container itself neither contains code, nor links with application specific bean implementations.

AccountService.wsdl: The definition of the web service provided by the bigbank server.

StockQuoteWebService.wsdl: The definition of the web service provided by www.webserviceX.NET. This web service is used by the StockQuoteServiceComponent of the bigbank composite.

Components.h and Components.C: These files provide implementations (in form of plain old C++ object classes) of the three components.

server.config: The Pococapsule Web Service application descriptor that describes this example's Web Service setup.

bigbank.account.composite: The OASIS-OpenCSA assembly descriptor that describes the wiring (connections) of components/ports in the OASIS-OpenCSA composite.

setup.xml: The main setup descriptors that first loads the needed library (the one contains component implementation classes) and then instantiates the web service engine and wires (connects) the OASIS-OpenCSA composite by importing the server.config and bigbank.account.composite.

client.C: The client application.

Building this example

To build this example, the environment variable POCOCAPSULE_DIR should point to the PocoCapsule/C++ installed directory. Also, this example assumes the Systinet server for C++ is installed and its runtime and development environment (such as WASPC_HOME environment variable pointing to its installation directory) are set properly according to its specification.

Once the environment is set and required Systinet server for C++ is installed and configured accordingly, this example can be built by simply invoking gmake/make on linux/unix or nmake on windows.

Running this example

· Before starting the server, make sure the LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows) environment variable is set correctly to include the ${POCOCAPSULE_DIR}/lib directory and the ${WASPC_HOME}/lib directory.

· start the bigbank AccountService server as:

prompt> server

The, start the client:

prompt> client [server-URL]

Here, the server URL is (optional, if client is on localhost): http://<server-address>:6070/AccountService.

On receiving client request, the server will contact the Web Serivces site www.webserviceX.net and print out the following messages:

GetQuote on www.webserviceX.net, pls wait ...
Stock IBM last price is : 95.03
Currency is : EURO

On client side, a account report will be printed out after receiving stock quote result from server:

Account Report
==============
Stock Account peter2006_STA12345
Stock Symbol : IBM
Holding : 1000
Value : 76024.00

Checking Account peter2006_CHA12345
Balance : 1200.00

Savings Account peter2006_SAA12345
Balance : 2000.00

Back to the root page