Monday, May 12, 2008

WSO2 WSF/PHP 1.3.0 Coming

WSF/PHP 1.3.0 will be released this week. We decided to cut down on the number of distributions this time around. In previous releases, we released binary packs which include rmp, deb and bin zip files. We will not be releasing those packs this time around. However if one is interested in creating a binary pack for himself using the source distribution, we are ready to help them. For 1.3.0 release we will have the source packs (zip, tar.gz) ,binary zip package for windows and pecl package.

Tuesday, April 1, 2008

PHP Web Services with IIS

I wrote an small guide to installing WSF/PHP in IIS.

Friday, March 21, 2008

Getting the server port in Generated WSDL

WSF/PHP generates WSDL for the familiar ?wsdl. Due to a bug, when the server  is run on a port other than 80, the generated wsdl's location attribute of the address was not printing the port. It is now fixed in the current svn head and you can get the latest nightly build.

Sunday, March 16, 2008

WSO2 WSF/PHP 1.2.1 Released

WSF/PHP Team is pleased to announce the release of WSF/PHP 1.2.1 release. We focused on improving contract first web services support for this release.Schema types support has been improved in this release. All of the current web services stacks for PHP requires the users to go through the WSDL file and pick up the data types and construct his clients and services accordingly. This is quite a cumbersome task. To make this task easier for the user, WSF/PHP 1.2.1 release includes wsdl2php script which can generate the clients and services for a given WSDL. This is an experimental feature that is still it the testing stage. But we hope that is will make the task of implementing Clients and Services easier than ever before.

Another major problem that was fixed in this release was the large attachment support problem. This was an issue that had propagated in to WSF/PHP from WSF/C. Since the changes in WSF/C attachment handling code, the attachments sending and receiving has been made much more efficient. In addition we were able to fix some documentation errors.  Following is the complete feature list for this release.

1. Client API to consume Web services
      * WSMessage class to handle message level options
      * WSClient class with both one way and two way service invocation support
      * Option of using functions in place of object oriented API with ws_request

2. Service API to provide Web services
      * WSMessage class to handle message level options
      * WSService class with support for both one way and two way operations
      * Option of using functions in place of object oriented API with ws_reply

3. Attachments with MTOM
      * Binary optimized
      * Non-optimized (Base64 binary)

4. WS-Addressing
      * Version 1.0
      * Submission

5. WS-Security
      * UsernameToken and Timestamp
      * Encryption
      * Signing
      * WS-SecurityPolicy based configuration

6. WS-Reliable Messaging
      * Single channel two way reliable messaging

7. WSDL Generation for Server Side
      * WSDL generation based on annotations and function signatures, and
        serving on ?wsdl or ?wsdl2 requests

8. WSDL mode support for both client and server side
      * Write services and client based on a given WSDL
      * WS-Addressing and WS-SecurityPolicy is supported in WSDL mode
9. REST Support
      * Expose a single service script both as SOAP and REST service

10. Provide easy to use classes for common services
      * Consume some well known services such as Yahoo search and Flickr
        and Amazon services using predefined classes

Experimental Features
---------------------

11. wsdl2php.php script. This script can generate PHP classes for services
    and clients for a given WSDL to be used with WSDL Mode .

We welcome you you try out this latest release. You can download it from here.

Thursday, March 13, 2008

WSF/PHP Demo site launched

Some interesting solutions were implemented on top of WSF/PHP Web Services framework and now they are available online at http://labs.wso2.org/wsf/php/.

Some samples, solutions, and links to many related articles are available here. More solutions, and samples will be added to this site regularly.

Wednesday, February 20, 2008

Creating a .net webservice client

I was working with getting some .net client and services with WSF/PHP. So thought of providing some usefull information to anyone interested. I will go through the process of getting WSF/PHP services and clients working with .net clients and services in the next few days. I start with writing on how to create a C# web service client, provided that you have a valid wsdl file or and endpoint which provides a valid wsdl for ?wsdl option.

Step1.
In visual Studio, go to new project->C#->Windows->Console application, and give your prefered name for a client. I will use name DemoClient for my client.


















Step 2.
Now you should be able to see the project from solutions explorer. Right click on the project and select the option, add Web Reference.

























Step3.
Then In AddWebReference dialog box, provide the url to your wsdl and click on the go button. Next provide a name for the web reference. Now you should have a web reference generated and added to your project. I used the WSDL Mode sample (wsdl_11_service.php) service that comes with WSF/PHP for generating this web reference.


















The name you give for your web reference will become a namespace in your project. I gave the name PurchaseOrder for the Web Reference. So the proxy code for this web service invocation will be generated with the namespace (Purchase Order).
Now in the my client code, I import this namespace.
using DemoClient.PurchaseOrder;
The service described in WSDL will be available as C# class to the client code. The operations defined for each service in the WSDL will become methods of the class. So invoking the web service operation is as simple as creating an instance of the required service class and calling the needed operation on it.
Eg.
ShippingTradeService stp = new ShippingTradeService();
int type = stp.GetType();

Friday, February 1, 2008

Creating a custom header using an xml string

Sometimes it is necessary to send data to the service using headers. When doing so, WSF/PHP supports two ways of doing this. It accepts recursive WSHeader arrays in its constructor. Also it is possible to put an xml string directly to the WSHeader constructor.

WSHeader constructor signature is as follows.
WSHeader:__construct(array options);

options is an associative array with the following values.
"ns"=> Namespace of the header
"prefix"=> If you want to associate a profix with the namespace, this can be used to set the prefix
"name"=> Localname of the header element
"data"=> string Array of WSHeader objects
"mustUnderstand" => Bool
"role" => int

So when sending a complex header element, one can use the array of WSHeader objects but sometimes this may get quite complex.

Instead it is now possible to pass the xml string of the header element's child to the "data".
Eg
$child = <<< XML
<product-id>5</product-id>
XML;

$header = new WSHeader(array("name"=>"product", "ns"=>'http://test.org', "data"=>$child));

How ever this only supports adding a single child element to the header. So hope to extend this to pass an array as well.