actions parameter not working for classmaps?
Hi there,
i tried expose some class methods to WSService.
class TestService
{
public function __construct()
{
}
/**
* @param string $name
* (xs:string)
* @return string $return
* (xs:string)
*/
public static function helloworld($name)
{
$res = 'HALLO '.$name. ' ;
return array('return' => $res);
}
}
$operations = array("hello"=>"helloworld");
$opParams = array("helloworld"=>"MIXED");
$actions = array("http://www.test.net/hello" => "hello");
$classes = array("TestService"=>array( "operations" =>$operations, "actions"=>$actions, "opParams"=>$opParams));
$srv = new WSService(array("bindingStyle"=>"doclit",
"policy" => $policy,
"securityToken" => $security_token,
"serviceName" => "TestWebservice",
"classes" => $classes));
This gives me the following error, while calling the operation hello from a client.
[Wed May 21 13:04:36 2008] [error] rampart_engine.c(266) [rampart][rampart_engine] Operation is NULL.
[Wed May 21 13:04:36 2008] [error] rampart_engine.c(84) [rampart][rampart_engine] Policy creation failed.
[Wed May 21 13:04:36 2008] [error] rampart_in_handler.c(113) [rampart][rampart_in_handler] ramaprt_context creation failed.
Without a classmap and the method helloworld not capsuled in the TestService class it works correct.
$srv = new WSService(array("operations"=>$operations,
"bindingStyle"=>"doclit",
"opParams"=>$opParams,
"policy" => $policy,
"securityToken" => $security_token,
"serviceName" => "TestWebservice",
"actions" => $actions));
-> no errors
Any idea what's wrong here?
- Login or register to post comments
- Printer friendly version
- 177 reads











Hi, You have to set the
Hi,
You have to set the "actions" option outside the "classes" option.
That is actions refers to "soap action" => "service operation" (not php function) pairs. So "actions" will be independent of class name. So you service WSService would be like,
$srv = new WSService(array("bindingStyle"=>"doclit",
"policy" => $policy,
"actions" => $actions,"securityToken" => $security_token,
"serviceName" => "TestWebservice",
"classes" => $classes));
I have attached a class map sample demonstrate the "actions" behaviour.
Thank you dimuthu for this
Thank you dimuthu for this sample.
I have adepted my code as you recommended. Now it looks like:
class TestService
{
public function __construct()
{
}
/**
* @param string $name
* (xs:string)
* @return string $return
* (xs:string)
*/
public static function helloworld($name)
{
$res = 'HALLO '.$name. ' ;
return array('return' => $res);
}
}
$operations = array("hello"=>"helloworld");
$opParams = array("helloworld"=>"MIXED");
$actions = array("http://www.test.net/hello" => "hello");
$classes = array("TestService"=>array( "operations" =>$operations));
$srv = new WSService(array("bindingStyle"=>"doclit",
"actions"=>$actions,
"opParams"=>$opParams
"policy" => $policy,
"securityToken" => $security_token,
"serviceName" => "TestWebservice",
"classes" => $classes));
This gives me the following error:
Catchable fatal error: Argument 1 passed to ReflectionClass::newInstanceArgs() must be an array, null given, called in wsf_wsdl.php on line 322 and defined in /usr/lib/php5/20060613/wsf_php/scripts/dynamic_invocation/wsf_wsdl_service.php on line 106Did I put the "opParams"-option in the wrong place?
I also tried to put it in the classes array - like this:
$classes = array("TestService"=>array( "operations" =>$operations,"opParams"=>$opParams));This produces the following error:
Object of class WSMessage could not be converted to string in /srv/www/htdocs/ws.php on line 14
Where do i have to put the opParams to work properly?
Thanks in advance for your help,
Sebastian
Hi, Looks like you are using
Hi,
Looks like you are using some older wsf_wsdl.php version. Just guess from your log message. Anyway the code attached is working for 1.3.0 or 1.3.1.
Thanks
Dimuthu