WSDL Service + Policy = Cannot find policy. Operation is NULL.
Hi,
I am having problems getting a service to correctly respond when applying a policy to a WSDL enabled service. I am using the /wso2-wsf-php-src-2.0.0alpha as downloaded from nightly builds.
As you can see in the below server log the problems start here
rampart_engine.c(364) [rampart][rampart_engine] Cannot find policy. Operation is NULL.
This is a simple example and is obviously missing any policy settings from the client end, however the server responds the same. I have tried numerous different ways of setting up a server but continue to hit this same problem. I have found that using WSA client requests and setting actions on the service gets around this however this will not be suitable for our application.
This is frustrating me as I have our entire framework ready to use WSF with wsdl gen, enc, signing, keystores, ttl and username token. We set up services in a matter of minutes by inherriting our base class... However we are almost to the point of dropping WSF/PHP, something I would really like to avoid as overall I am very impressed with what it has to offer! Also, for integration 1.3.2, is not option as we require keystores.
Thanks,
Grant
Server
class TestService {
public function __construct() {}
/**
* @param string $name
* (xs:string)
* @return string $return
* (xs:string)
*/
public 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));
$security_token = new WSSecurityToken(array("user"=>"b",
"password"=>"b12345"));
$sec_array = array("algorithmSuite" => "Basic256Rsa15",
"securityTokenReference" => "KeyIdentifier",
"includeTimeStamp" => TRUE,
);
$policy = new WSPolicy(array("security"=> $sec_array));
$srv = new WSService(array("bindingStyle"=>"doclit",
/*"actions"=>$actions,*/
"opParams"=>$opParams,
"policy" => $policy,
"securityToken" => $security_token,
"classes" => $classes));
$srv->reply();
Client
class hello {
public $name; // string
}
class helloResponse {
public $return; // string
}
// define the class map
$class_map = array(
"hello" => "hello",
"helloResponse" => "helloResponse");
try {
$client = new WSClient(array ("wsdl" =>"http://mysite.com/hello.php?wsdl",
"classmap" => $class_map));
$proxy = $client->getProxy();
// create input object and set values
$input = new hello();
$input->name = "test";
// call the operation
$response = $proxy->hello($input);
print_r($response);
} catch (WSFault $e) {
printf("Soap Fault: %s\n", $e->Reason);
} catch (Exception $e) {
printf("Message = %s\n", $e->getMessage());
}
Server Log
[Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf.c(943) [WSF/PHP] setting message operation parameters [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf.c(1031) [WSF/PHP] request xop 0 [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf.c(1037) [WSF/PHP] policy object present [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf.c(1051) [WSF/PHP] security token object present [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf_util.c(1804) [WSF/PHP] classname -> TestService [Thu Aug 21 03:49:43 2008] [debug] phase_resolver.c(139) Service name is : DebitCard_hello.php [Thu Aug 21 03:49:43 2008] [debug] phase_resolver.c(723) Module name is:addressing [Thu Aug 21 03:49:43 2008] [debug] phase_resolver.c(2058) Trying to add this handler AddressingInHandler to system pre defined phases , but those handlers are already added to global chain which run irrespective of the service [Thu Aug 21 03:49:43 2008] [debug] phase_resolver.c(723) Module name is:addressing [Thu Aug 21 03:49:43 2008] [debug] phase_holder.c(139) Add handler AddressingOutHandler to phase MessageOut [Thu Aug 21 03:49:43 2008] [debug] phase_resolver.c(723) Module name is:addressing [Thu Aug 21 03:49:43 2008] [debug] phase_resolver.c(723) Module name is:addressing [Thu Aug 21 03:49:43 2008] [debug] phase_holder.c(139) Add handler AddressingOutHandler to phase MessageOut [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf_worker.c(399) [WSF/PHP] Client HTTP version HTTP/1.1 [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf_worker.c(87) [WSF/PHP] Unable to find HTTPMethod for location: (null) [Thu Aug 21 03:49:43 2008] [debug] soap_builder.c(895) Identified soap version is soap11 [Thu Aug 21 03:49:43 2008] [debug] phase.c(210) Invoke the handler request_uri_based_dispatcher within the phase Transport [Thu Aug 21 03:49:43 2008] [debug] phase.c(210) Invoke the handler AddressingInHandler within the phase Transport [Thu Aug 21 03:49:43 2008] [info] Starting addressing in handler [Thu Aug 21 03:49:43 2008] [info] addr_in_handler.c [Thu Aug 21 03:49:43 2008] [debug] phase.c(210) Invoke the handler addressing_based_dispatcher within the phase Transport [Thu Aug 21 03:49:43 2008] [debug] phase.c(210) Invoke the handler RampartInHandler within the phase PreDispatch [Thu Aug 21 03:49:43 2008] [error] rampart_engine.c(364) [rampart][rampart_engine] Cannot find policy. Operation is NULL. [Thu Aug 21 03:49:43 2008] [error] rampart_engine.c(99) [rampart][rampart_engine] Policy creation failed. [Thu Aug 21 03:49:43 2008] [error] rampart_in_handler.c(114) [rampart][rampart_in_handler] rampart_context creation failed. [Thu Aug 21 03:49:43 2008] [error] phase.c(233) Handler RampartInHandler invoke failed within phase PreDispatch [Thu Aug 21 03:49:43 2008] [error] engine.c(696) Invoking phase PreDispatch failed [Thu Aug 21 03:49:43 2008] [error] engine.c(255) Invoking pre-calculated phases failed [Thu Aug 21 03:49:43 2008] [debug] /root/installs/wso2-wsf-php-src-2.0.0alpha/src/wsf_worker.c(589) we are here safely 2
Messages
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><ns1:hello xmlns:ns1="http://www.wso2.org/php/xsd"><ns1:name>test</ns1:name></ns1:hello></soapenv:Body></soapenv:Envelope> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><soapenv:Fault><faultcode>wsse:FailedCheck</faultcode><faultstring>Error in the Internal configuration.</faultstring><detail><wsse:ProblemSecurityHeader xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">rampc:Policy</wsse:ProblemSecurityHeader></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
- Login or register to post comments
- Printer friendly version
- 230 reads











Hi grantb, This might cause
Hi grantb,
This might cause most probably because you are using WSDL Generation.
Can you save the generated WSDLs in a file and use "wsdl" option in the WSService class to refer to the saved WSDL and try. It should definitely work.
Thanks
Dimuthu
Hi Dimuthu, Thank you for
Hi Dimuthu,
Thank you for your suggestion. Since my post we have now rolled back to 1.3.2 with a few bug fixes (i.e. wsdl generation with 2 methods produces bad wsdl, was fixed in alpha 2.0 & specifying default namespace). As our services are secure and released to "known" clients only we now switch on the source IP to select the Client Cert (instead of using a keystore).
Having said that we won't be installing the alpha again so I can't test out your theory.
Also, I've just set up our base class so that it writes the generated wsdl to disk on first request to wsdl/wsdl2 therefore all subsequent requests use the 'wsdl' option in the WSService construct call. This will obviously improve efficiency and hopefully when we next upgrade wsf/php it will resolve the issue of this post.
Thanks Again,
Grant