Hi Nandika, I have a question regarding wsf/php. Can you please contact me on Skype (o_daan)? It's rather important to me, I would really appreciate your reply. Thanks, Daniel
Thanks so much for responding. I was unable to register on the forum, that is why I contacted you here. I get an error when constructing a SOAP request with WS-Security. The error is: [rampart]SOAP header cannot be found. I read somewhere that it could be a problem with WSF in combination with PHP 5.3. Is that true?
An exception is thrown, saying "Error, NO Response Received", and $client->getLastRequest() returns NULL.
In pseudo code I have this:
$securityToken = new WSSecurityToken(array( "privateKey" => ws_get_key_from_file('MyPrivate.key'), "certificate" => ws_get_cert_from_file('MyPublic.cer'), "receiverCertificate" => ws_get_cert_from_file('ServerCertificate.pem'), "ttl"=>300 )); $policy = new WSPolicy( [policy xml from the wsdl]); $message = new WSMessage([xml body], [to/action]);
On PHP 5.3, WSF/PHP has few issues with wsdl mode. Therefore, I would like to suggest you to use the xml-in-out mode for implementing the client. Usually, the error NO Response received comes, when the client is unable to connect to the service endpoint meaning that, the endpoint address is incorrect.
Hi Nandika,
ReplyDeleteI have a question regarding wsf/php. Can you please contact me on Skype (o_daan)? It's rather important to me, I would really appreciate your reply. Thanks,
Daniel
Hi Daniel,
ReplyDeleteWhat is the issue you are having with wsf/php. Post the question here or at wsf/php forum. I would be happy to help you.
Regards
Nandika
I have explained the problem in the comment below. Thanks.
DeleteHi Nandika,
DeleteWould you mind having a look at the issue I posted? I could really use your help.
Thank you.
Daniel
Hi,
ReplyDeleteThanks so much for responding. I was unable to register on the forum, that is why I contacted you here. I get an error when constructing a SOAP request with WS-Security. The error is:
[rampart]SOAP header cannot be found.
I read somewhere that it could be a problem with WSF in combination with PHP 5.3. Is that true?
An exception is thrown, saying "Error, NO Response Received", and $client->getLastRequest() returns NULL.
In pseudo code I have this:
$securityToken = new WSSecurityToken(array(
"privateKey" => ws_get_key_from_file('MyPrivate.key'),
"certificate" => ws_get_cert_from_file('MyPublic.cer'),
"receiverCertificate" => ws_get_cert_from_file('ServerCertificate.pem'),
"ttl"=>300
));
$policy = new WSPolicy( [policy xml from the wsdl]);
$message = new WSMessage([xml body], [to/action]);
$client = new WSClient(
'useSOAP'=>1.2,
'wsdl' =>'https://.../wsdl.xml',
'to'=>'https://...',
'securityToken'=>$securityToken,
'policy'=>$policy,
'CACert' => 'ServerCertificate.pem');
$client->request($message);
Hope to hear from you soon!
Daniel
Hi Daniel,
ReplyDeleteOn PHP 5.3, WSF/PHP has few issues with wsdl mode. Therefore, I would like to suggest you to use the xml-in-out mode for implementing the client. Usually, the error NO Response received comes, when the client is unable to connect to the service endpoint meaning that, the endpoint address is incorrect.
Regards
Nandika
Hi Nandika,
ReplyDeleteWhat do you mean with "xml-in-out" mode? The endpoint returns a soapfault when I change the ws-security configuration, so it must be right.
Thanks,
Daniel
Hi Nandika,
ReplyDeleteI've got a similar issue while using the username token scenario.
Before using php 5.2.x with 2.0.0 it was working like a charm - now it's pain in order to get the same scenario working on 2.1.0 php 5.3.
Basically i've got something like that ( also in pseudo code ):
----
$policy = file_get_contents( policy.xml ); // The one from call_back folder.
$oPolicy = new \WSPolicy( policy )
$oSec = new \WSSecurityToken( array(
'user' => 'USERNAME',
'password' => 'PWD',
'passwordType' => 'Digest',
'ttl' => '300' )
$oSoapClient = new \WSClient(
array(
wsdl => http://www.xxxxx.xx/comparatorservices/CalculationService?WSDL.
to => http://www.xxxxxx.xx/comparatorservices/CalculationService,
useWSA => true,
useSOAP => 1.1,
securityToken => $oSec,
policy => $oPolicy
));
$proxy = $this->oSoapClient->getProxy();
$response = $proxy->theMethodToCall( $mySuperObject );
----
The logs in log.level 4 let appear :
[Wed Jul 25 03:31:12 2012] [debug] http_transport_utils.c(3794) No session map stored
[Wed Jul 25 03:31:12 2012] [error] http_sender.c(1330) Error occurred in transport
....
[Wed Jul 25 03:31:13 2012] [error] rampart_in_handler.c(91) [rampart]SOAP header cannot be found.
[Wed Jul 25 03:31:13 2012] [error] phase.c(224) Handler RampartInHandler invoke failed within phase Security
[Wed Jul 25 03:31:13 2012] [error] engine.c(657) Invoking phase Security failed
[Wed Jul 25 03:31:13 2012] [error] engine.c(262) Invoking operation specific phases failed for operation __OPERATION_OUT_IN__
[Wed Jul 25 03:31:13 2012] [error] /home/agruet/08_KRK_sources/wso2-wsf-php-src-2.1.0/src/wsf_wsdl.c(1226) [wsf_wsdl] Response envelope not found
----
I inspected with tcpdump the soap header from the 2.1.0 and the 2.0.0 - not really differents, the only difference come from the wsse:Security tag
on 2.0.0 it's like :
wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
on 2.1.0 it's like :
wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1"
But i can't imagine the issue come from this.
Any advices in order to understand what's wrong ? Any help could be usefull ... Sincerly i search for a long time without any answer on this issue....
Best regards,