我们想创建一个使用 WS 安全性但没有签名和加密的 PHP WSO2 Web 服务客户端。相反,我们想使用一个简单的密码。问题是:我们总是收到证书错误(见下文)。我们真的必须安装证书吗?如果是的话:在哪里?Java 密钥库?
环境:PHP 5.3.10、WSO2 PHP 2.10、Apache 2.2.x
wfs_client_log:
[错误] key_mgr.c(295) [rampart][rampart_signature] 未指定公钥证书文件。[错误] armart_signature.c(856) [rampart][rampart_signature] 无法获取证书 [错误] armart_sec_header_builder.c(131) [rampart][shb] 签名失败。错误 [错误] rampart_sec_header_builder.c(601) [rampart][shb] 非对称绑定失败 [error] rampart_out_handler.c(130) [rampart]安全标头构建失败。[错误] phase.c(224) 处理程序 RampartOutHandler 在阶段安全性内调用失败 [错误] engine.c(657) 调用阶段安全性失败
PHP代码是:
<?php
// Endpoint WebService
$endPoint = 'http://xxx.xxxx.xxx:7000/orabpel/selfservice/passwortAendernMBE/1.0';
// Security-Payload
$user = 'mustermann123';
$passwortAlt = 'foo';
$passwortNeu = 'bar';
// create Security-Token
$secToken = new WSSecurityToken(array(
"user" => $user,
"password" => $passwortAlt,
"passwordType" => "PlainText"));
// create SecurityPolicy
$policy = new WSPolicy(array(
"security" => array(
"useUsernameToken" => TRUE)));
// create WS-Client
$client = new WSClient( array(
"to" => $endPoint,
"useSOAP" => "1.1",
"action" => "process",
"policy" => $policy,
"securityToken" => $secToken));
// create SOAP-Payload
$soapPayload = '
<ns1:passwortAendern_processElement xmlns:ns1="http://xxxx.xxxx.xxxxxe/Integration/prozesse/xxxxxxSchema"
xmlns:ns2="http://xxxx.xxxx.xxx/types/xx.xxx.xxxx.selfService.prozesse.xxx.xxxxMessage">
<ns1:passwortAendernMessage>
<ns2:benutzerkennung>' . $user . '</ns2:benutzerkennung>
<ns2:passwortAlt>' . $passwortAlt . '</ns2:passwortAlt>
<ns2:passwortNeu>' . $passwortNeu . '</ns2:passwortNeu>
</ns1:passwortAendernMessage>
</ns1:passwortAendern_processElement>';
// Request
$soapResponse = null;
try {
// soap Request
$soapResponse = $client->request( $soapPayload );
// print out Response
echo '<pre>';
print_r(htmlspecialchars( str_replace('>','>'.PHP_EOL,$soapResponse->str ) ));
echo '</pre>';
} catch(Exception $e) {
echo '<h1>Error:</h1>' . PHP_EOL;
var_dump($e);
}
// dump Soap-Parameters
echo '<h1>Soap-Parameter</h1>' . PHP_EOL;
var_dump($soapPayload);
// dump Soap-Response
echo '<h1>Soap-Response</h1>' . PHP_EOL;
var_dump($soapResponse);