Thursday, September 24, 2009

New Blog on C++ Web Services

We created a new blog http://cppwebservices.blogspot.com/ which will work as an aggregator for discussing matters related to doing Web Services, SOA in C++. The plan to get it to the same level like http://www.phpwebservices.blogspot.com/ which is an aggregated blog where you can find lots of details on PHP Web Services.

The blog would be primarily discussing  how you can get web services running smoothly With WSF/C++Web Services Framework.  WSF/C++ comes with lots of features as demonstrated by the following architecture diagram.

wsf-cpp-architecture

Tuesday, September 1, 2009

Getting Started with Axiom/CPP

WSF/CPP comes with its own XML processing model which is Axiom. If you are already familiar with either Axiom/Java or Axiom/C it would not be difficult to grasp how to use Axiom/CPP.

Lets have a look at an small example. Say we want to construct an XML as follows.

<WSO2 xmlns:ns1="http://wso2.org">

<projects>

<WSF>

<WSFCPP>http://wso2.org/projects/wsf/cpp</WSFCPP>

<WSFPHP>http://wso2.org/projects/wsf/php</WSFPHP>

</WSF>

</projects>.

</WSO2>

Lets construct this xml using Axiom/CPP.

First call the Environment::initialize() method to initialize WSF/CPP.

 

Now create OMElement in the corresponding order. You can pass the parent element to the constructor of the child element. The code is self explanatory.

int main()

{

  Environment::initialize("test.log",AXIS2_LOG_LEVEL_TRACE);

   OMElement *wso2 = new OMElement(NULL,"WSO2", new OMNamespace("http://wso2.org","ns1"));
    OMElement *projects = new OMElement(wso2, "projects");;
    OMElement *wsf = new OMElement(projects,"WSF");
    OMElement *wsfcpp = new OMElement(wsf, "WSFCPP");
    wsfcpp->setText("
http://wso2.org/projects/wsf/cpp");
    OMElement *wsfphp = new OMElement(wsf, "WSFPHP");
    wsfphp->setText("
http://wso2.org/projects/wsf/php");

    cout<<wso2;
    delete wso2;

   return 0;

}

Common Issue with Certificates created on Windows

One of the common issues faced when dealing with certificates for doing SSL communication or WS-Security is that the certificates created on windows does not work on Linux. This is due to the addition of Windows Specific characters to the certificate. I have seen so many users struggle to get SSL/HTTPS working due to this problem.

So easiest thing to do, if you want to run a client with HTTPS on Linux with a certificate created on windows, just do a dos2unix on the certificate.  :)

This should help you save a lot of time.

Building WSF/PHP with PHP 5.3.0

Since the release of PHP5.3.0 number of requests were there inquiring the compatibility of WSF/PHP with PHP 5.3.0.  I tried it out on windows and I only encountered minor issues. These issues are now fixed on the svn trunk. Here is how you can build WSF/PHP from the svn source to use with PHP 5.3.0.

First download both PHP 5.3.0 source and binary distributions from php.net. You will also need to download the binary tools such as bison.exe which are required to build the PHP source.

Next you need to run the buildconf.bat contained with the php source in order to build the windows specific headers.

Now you are ready to build wsf/php for php 5.3.0.

Get the svn source of wsf/php from  https://wso2.org/repos/wso2/trunk/wsf/php.

svn co http://wso2.org/repos/wso2/trunk/wsf/php wsfphp

Now cd to wsfphp directory and open the configure.in file and set php configurations as follows.

PHP_SRC_DIR = E:\php\php-5.3.0
PHP_BIN_DIR = E:\php\php-5.3.0-Win32
BINDLIB_DIR = E:\php\bindlib-cvs-vc8

Of course you need to set the other dependencies according to your machine configurations.

Now run the build.bat file. This will build wsf/php binary for php 5.3.0