WSO2 WSF Framework for PHP released

According to Yahoo Biz, a company called WSO2 released their WSO2 WSF Framework C-library. What is more appealing is that there are now bindings for PHP available under a Apache 2.0 license. The company WSO2 describes itself as: „We are thought leaders in the Apache Web service project, where our engineers are core contributors to key projects including Apache Axis2, Apache Sandesha, Apache Rampart, Apache Neethi, Apache Axiom and Apache Synapse.“

There’s a nice picture available ( (C) by WSO2) which shows how the library + the bindings (yes, there’s also an AJAX binding for Firefox available!) fit into the architecture:

„But PHP5 has its own SOAP extension… why use this one?“ – Automatic WSDL generation (through annotations in your Docblock), WS-Security, SOAP-MTOM, WS-SecurityPolicy, WS-ReliableMessaging, WSDL 1.1, WSDL 2.0, REST, SOAP 1.1, SOAP 1.2 – enough said? No:

WSO2 WSF/PHP features proven interoperability with Microsoft .NET, WSO2 WSAS (Apache Axis2/Java based Web services application server) and other J2EE implementations. The basic SOAP level interoperability as well as WS-* specification implementations have been tested and proven to interoperate.

Here’s a short step-by-step guide how to install the source distribution it for your PHP5 installation on Linux:

  • go to http://dist.wso2.org/products/wsf/php/1.0.0/ and download the tgz package
  • tar xvzf it
  • don’t forget to make a export PATH=/path/to/your/php-config-binary/:$PATH if your php-config binary is not in the standard PATH
  • run ./configure, make and make install

The extension will be installed in your PHP5’s extension directory. It installs a wsf_c directory for the axis2 library and a wsf.so which can then be included in your php.ini. If you install the library in another directory, be sure to set the wsf.home to the appropriate path in your php.ini. After restarting your webserver, a phpinfo should look like this:

 

 

There’s an extensive User Manual available. As you can see, WSF uses a slightly different namespace than ext/soap, so both can coexist and the rewriting of your existing SOAP projects should be a no-brainer. All in all, good work, WSO2! Our blog will cover some of the features in the following posts.

Extending class SoapServer (PHP5) for debugging

In one of our large projects the application platform we developed provides a SOAP Service to several external entities (mainly .NET, Java and VisualBasic based, both web application and desktop software). These entities are spread across Europe and involve both internal consumers (departments from our customer) and external consumers (other solution providers that want to dock their solution onto the platform and interact with it remotely through the SOAP interface).

The SOAP Service, a SOAP server based on PHP5’s ext/soap, provided only small debugging capabilities, mainly for some methods during the pre-testing phase that error_log‚ed to a logfile on the server. This was a sufficient short-term solution up-to-date, for eliminating outstanding bugs during development and testing with the SOAP consumers.

However, for long-term reasons (it’s a large multi-year project) and to provide more comfort for our customer (internal monitoring) and the communication from us (the development team) to the external entities (internal/external consumers of the webservice), we decided to improve the debugging capabilities of the SOAP service. It should log the time of the SOAP request (to pinpoint bottlenecks and see if bottlenecks come from routing reasons or from the platform itself), the issued SOAP commands, the full XML that was received and sent and several other information.

For those of you who don’t know, there’s a pretty easy way to achieve this (thanks to Marco for implementing the solution): you can easily extend PHP5’s SOAPServer class and hook into the constructor and handle() method to implement your debugging code. Unfortunately at the moment (does anyone know if there’s perhaps some undocumented function for this? Or does SCA support any of these capabilities out of the box?) we have to preg the submitted SOAP XML to get all information out of it. Below you can find some sample code.

Weiterlesen

Real life SOAP: connecting your browser to a VoIP PBX

VoIP is not only fun with Skype. Instead, your company might use OpenSource solutions like Asterisk
or even more proprietary solutions like an Innovaphone VoIP infrastructure. Here at Mayflower, we’re using two Innovaphone IP800 gateways at each of our departments (Munich and Würzburg). They are connected to each other and replicate their data. Besides that, the Gateways do use LDAP for saving the contact data and provide a SOAP interface for connecting to the PBX.

In a crazy moment in my sparse free time, I had a look at Gregor’s PhoneMonitor application he’s written in C# and decided to write a PHP5 based approach to connect to the PBX and handle calls.

The result is a SOAP client library that is able to connect to a PBX, poll for events, register users and create calls between two endpoints.

Making calls is a piece of cake:

// $pbxbase is an instance of a class that handles the low-level PHP5 SOAP calls
$sessionId = $pbxbase->createSession('Björn Schotte', 'mydemoapp');
$userobj = $pbxbase->createUserObjectID('Björn Schotte', true);

$pbxuser = new PBXUser($pbxbase);
$call_handle = $pbxuser->callCN($userobj, 'Gregor Streng');
// if you want to dial an external number, just use
// $call_handle = $pbxuser->callPhone($userobj, '093112345');

This will place a call between me (cn „Björn Schotte“) and Gregor (cn „Gregor Streng“). If I run this script from command line, my hardware telephone (or my softphone if I’m on Mauritius :-) ) will ring and if I pick up I’ll have Gregor on the line.

In the screenshot you can see a small Firefox sidebar application (streaming) that polls for events on the PBX, meaning that is able to show which user in your PBX group currently has an active call and which user is free (in the screenshot „Björn Schotte“ is currently having an active call and his name displayed in red + a small icon. If he hangs up the phone, his name will be displayed normally and the icon will disappear). The next step will be some kind of integration in our groupware PHProjekt so that I’m able to easily call a contact inside the web application. Of course, there’s also TAPI, but SOAP could be another approach.

I’m not sure if there’s something similar yet available for the Asterisk stuff (SOAP interface). Does anyone have a clue?