Deploy your PHP class as a Webservice

Thursday, January 10, 2008

With the new WSO2 WSF/PHP 1.2 you can publish PHP classes as a web service.

You are able to publish multiple PHP classes as a web service. Then your PHP code for the WSService would be something like this..


/* set operations and constructor arguments for the class1 */

$class1_operations = array("service_operation" => "php_class_function_in_class1",
/* and so on..*/);


$class1_constructor_arguments = array("arg1", "arg2", /* and so on..*/);

/* set operations and constructor arguments for the class2 */


$class2_operations = array("service_operation" => "php_class_function_in_class2",
/* and so on..*/);

$class2_constructor_arguments = array("arg1", "arg2", /* and so on..*/);


/* set these in to the classes option of the WSService in following way */

new WSService(array("classes" => array(

"class1_name" => array("operations" => $class1_operations, "args"=> $class1_constructor_arguments),
"class2_name" => array("operations" => $class2_operations, "args"=> $class2_constructor_arguments) ) ) );

Visit here for a good sample of an application of this feature..

No comments: