WSF/PHP supports implementing a service using a php class. One of the advantages of implementing the service Operations with in a class is that is gives the ability to pass arguments to the constructor of the class.
Following is a simple example.
private $value = "";
$this->value = $str;
$responsePayloadString = <<<XML
<ns1:echostring ns1="<a href=">http://wso2.org/projects/wsf/php</a>">
return new WSMessage($responsePayloadString);
$operations = array("echoString" => "echoValue");
$service = new WSService(
array( "classes" => array("Bar" =>
"args" => array("Hello")
Note that Bar class is just a very simple PHP class. It's constructor takes a string argument and echo that value.
Next you have to define the Operations array with is very simple.
Next you need to tell the WSService class about your class, its defined operations and its arguements.
WSService options array accepts a parameter named "classes" which is an associative array. Its key is the class name and value is another array with contains the "operations" options and "args" options. "operations" are the operations defined in the class. The "args" is an array of arguments to the constructor of the corresponding class. Since the "Bar" class has a single argument constuctor, we are providing an string.