Installing wsf/php in a third party hosting environment

Wednesday, August 6, 2008

If you have a third party hosting environment and you want to use wsf/php extension, you have to set to deploy the PHP as cgi-based and not through traditional mod_php. That way you will be able to use custom php.ini and configure wsf/php installation. Make sure to check whether your hosting service have capability to deploy cgi-based php and any documentation for that. For an example dreamhost provides following documentation for that. http://wiki.dreamhost.com/Custom_PHP.ini

There may be some hosting environments (Here I mean hosting services deployed php in linux based systems) that you are not have permission to read root directories. So in such cases you have to set the extension_dir entry in the php.ini relative to the cgi-bin directory in your document root. But wsf/php 1.3.2 and lower versions having a problem of not loading wsf.home directory when you are using WSClient class. But it works well for WSService by default.

You can solve this problem by putting the following code right before you use WSClient.

$script_dir = dirname($_SERVER['PHP_SELF']);
$htdocs_dir = '.'.preg_replace('/[^\\/']+/, '..', $script_dir);
$cgibin_dir = $htdocs_dir.'/cgi-bin';


chdir($cgibin_dir);



For an example if you put the above code to the echo client in sample directory it would be like,


$requestPayloadString = <<<XML
<ns1:echoString xmlns:ns1=http://php.axis2.org/samples><text>Hello World!</text></ns1:echoString>

XML;

try {


$script_dir = dirname($_SERVER[
"PHP_SELF"]);
$htdocs_dir =
".".preg_replace("/[^\\/"]+/, "..", $script_dir);
$cgibin_dir = $htdocs_dir.
"/cgi-bin";


chdir($cgibin_dir);

$client = new WSClient(array( to =>
"http://test.dimuthu.org/samples/echo_service.php" ));


$responseMessage = $client->request( $requestPayloadString );

printf(Response =
"%s <br>", htmlspecialchars($responseMessage->str));


} catch (Exception $e) {

if ($e instanceof WSFault) {

printf(Soap Fault:
"%s\\n", $e->Reason);
} else {
printf(Message = "%s\\n
",$e->getMessage());
}


}
?>

Nested Queries with PHP Data Services

Monday, August 4, 2008

If you have been aware of PHP Data Services, You may be already know that it is going to be a major feature in the WSF/PHP 2.0.0 release. In fact you can download it from here and run it with WSF/PHP older versions as well.

I wrote a little guide/ tutorial on how to do nested queries with PHP Data Services over here. Hope this will be usefull for people who were looking for some documentation on how to use this library in addition to the samples and the online demos.

WSDL Mode Improvement for the next release

Thursday, July 31, 2008

Nandika has recently blog about the latest major features in the next WSF/PHP release. In addition to that it has some minor features as well. One of that big minor feature is it is bundled with the complete support for the WSDL mode.

In the last release we have done lot of improvements to the wsdl mode so it was able to handle most of the common wsdls you can find in public and enterprise. And from this release,
  • You can send and recieve MTOM, SWA attachements in WSDL mode, Whenever you found base64Binary in wsdl you can specify send this type as MTOM or SWA attachment using the useMTOM option.
  • You can send and recieve SOAP headers using WSDL mode.
  • The xsi:type based serialization and deserialization. This allows you to send and recieve Child type in place of parent schema types. In other terms you can work with the true polymorphism in your xml messages.
Please look at the latest test cases for the wsdl mode in svn.

New features for next release

You can find out some of the interesting new features that will be available with the next release of WSF/PHP here.

Mashups for the Enterprise

Sunday, July 27, 2008

Can Mashups be useful in an enterprise setup, or are they only for those who fun loving folks to put things together and do wired stuff?

Well, you can do use Mashups in an enterprise setup. How?

Decision supporting tools are very welcome in decision making in an organization. Often, we have data, lots of them, available in various forms. SOA technologies available today make the data readily accessible, with ease, across systems. However, they are still data. What is required is to have meaning to those data, in other words to turn them into information to help make decisions that would direct the enterprise in the right direction. Mashups can help here, aggregating multiple services into one stop shop information sources.

As an example, you could use a Mashup to track how you are doing with your CRM. Aggregate CRM data into a Mashup dashboard to monitor customer queries, their frequencies, time to respond, and the like.

Now, in order to do this, you need tools, serious tools, tools like WSO2 Mashup Server.

If you look into the CRM example that I mentioned above, you need to be able to access data as services, and then aggregate those into meaningful representations. According to the overview of the technical capabilities of the Mashup server, provided by Channa, the product manager for the project, you can easily deal with data services. Not only that, in the CRM example, security is paramount, as you would not want the sensitive data like those on your customers to be leaked out. So you need, trusted, proved and battle tested security system in place. And again, as Channa has explained, WSO2 Mashup server is equipped with such security capabilities.

mooshup.com, an online hosted instance of WSO2 Mashup server not only shows that it works, but also proves that it is battle tested.

All the features in the WSO2 Mashup server are well thought of and put in place to help the enterprises use Mashups. However, you are still only interested in the fun part of it, nothing prohibits you from that.

What was Microsoft Doing @ OSCON?

Saturday, July 26, 2008

Well, they partnered with WSO2, to bridge Microsoft products and open source technologies.

The booth attracted very interesting people. There were very interesting questions. Some asked on why WSO2 should be partnering with the software giant. Some were keen on the technologies that we were offering. Some were just curios on the intentions of Microsoft. And some even thought that we were marketing a stock trader application that runs on Windows platform. Some even asked, SOA - what is that?

Some were very skeptical, and Sanjiva has answered them already.

The best part was the story we had and there were quite a number of people who were looking for just such a story. The seamless interoperability between .Net, Java and the scripting space, demonstrated by the stock trader application was a dream come true. We had PHP, Ruby, Python, Perl on one end, Java on another and .NET on another. The three layers of the sample app, one client layer and two service layers, could be mixed and matched, irrespective of the implementation. And the business models of the two organizations involved in this effort was drastically different, yet the application did not care and worked perfectly. Closed source and open source and live together, work together, and make the enterprises thrive and prosper.

WSF/PHP Demo Site Back in Action

Friday, July 25, 2008

After some maintenance work over last few days WSF/PHP Demo site is up back again. And note that this is not just a list of demos run using WSF/PHP package. It actually provide the source code of the demos and documentations if there are any.
So here is an update of what you can find in this site.
  • Solutions with Source code + documents

  • Allow you to see wsf/php samples in the web.

  • Tools

    • wsdl2php tool - generate the wsf/php client and service code from the wsdl

    • php2wsdl tool - generate the wsdl for your wsf/php server code

    • dbs2php tool - generate the php code from the WSAS Data services configuration files



  • Libraries

    • Data services library

    • Helper libraries for some public web service invocations like flickr, amazon, yahoo search


  • Space to comments and feedbacks, and give a rate to your favorite solutions

FAQ for WSF/PHP Installation

Thursday, July 24, 2008

I wrote a little FAQ on installing WSF/PHP based on the recent forum posts and user mails. http://www.dimuthu.org/blog/2008/07/24/faq-for-wsfphp-installation/.
Please have a look at on that and let us know anything else missing there..

Interoperability demo PHP, PERL, RUBY, JAVA, SPRING and .NET Web Services

If you are around OSCON, don't miss this. There you can see a live demo for interoperability of web services using WSO2 WSF/PHP, WSF/Ruby, WSF/Perl, WSF/Python, WSF/Spring and WSAS and Microsoft .NET technologies. http://www.marketwatch.com/news/story/wso2-adds-three-platforms-microsoft/story.aspx?guid={16B1B777-531B-49FD-82BA-6D4CD426FD2F}&dist=hppr

Steps to Install WSF/PHP with WAMPServer

Monday, July 21, 2008

Have you ever tried installing wsf/php in WAMPServer. Yesterday I did a try. I noted down the steps i followed in my new blog. http://www.dimuthu.org/blog/2008/07/19/install-wsfphp-with-wampserver/
People who want WAMPServer to write php in windows (like me) may find this useful. :)

PHP Web Services Training, Support and Consulting

Saturday, July 19, 2008

Did you know that WSO2 provides commercial training, support as well as consulting on PHP Web services?

Yes, the product is open source. But if you are looking for production support or development support, contact WSO2 Inc.

The consultancy services, on how to design your PHP application in the SOA and ROA era would be ideal, if you are looking to either re-engineer or re-structure your PHP application platforms.

SOAP, REST, ESB and SOA, WSO2 is the right partner.

PHP Web Services Interoperability Expanding

Friday, July 18, 2008

WSO2 Web services framework for PHP (WSF/PHP) was featured on Microsoft TechEd in June. And now, the contours of interoperability is expanding. In addition to the .NET and Java implementations, Perl, Python and Ruby are being added to the story. So it is becoming reality. Real world applications, written in different languages, can seamlessly interoperate, not only at basic SOAP level, but also with advanced Web services protocols such as security.

Accessing http response headers with WSF/PHP

Sometimes it is necessary to access the http response header that comes with the response. It is specially useful if the response http headers contain a session id.

WSClient has the function getHttpResponseHeaders() which returns an associative array of http headers. Using it, you can easily access the http headers.

Example code

$client->request($payload);

$headers = $client->getLastResponseHeaders();

var_dump($headers);

Following is an output of the received http headers.

array(5) {
  ["Date"]=>
  string(29) "Fri, 18 Jul 2008 09:06:55 GMT"
  ["Server"]=>
  string(30) "Apache/2.2.4 (Win32) PHP/5.2.5"
  ["X-Powered-By"]=>
  string(9) "PHP/5.2.5"
  ["Content-Length"]=>
  string(3) "240"
  ["Content-Type"]=>
  string(34) "application/soap+xml;charset=UTF-8"
}