2017-06-17 90 views
0

我有一个WSSE安全首部客户电话:WSSE安全PHP SoapServer-头不明白

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-7BCCD9337425FBA038149772606059420"><wsse:Username>USERNAME</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NONCE</wsse:Nonce><wsu:Created>2017-06-17T19:01:00.594Z</wsu:Created></wsse:UsernameToken></wsse:Security></soapenv:Header> 
    <soapenv:Body> 
     <ns:FUNCTION/> 
    </soapenv:Body> 
</soapenv:Envelope> 

由于SoapServer的我有一个简单的一个:

// the SOAP Server options 
$options=array(
    'trace' => true 
    , 'cache_wsdl' => 0 
    , 'soap_version' => SOAP_1_1 
    , 'encoding' => 'UTF-8' 
); 

$wsdl = 'http://localhost/index.php?wsdl'; 

$server = new \SoapServer($wsdl, $options); 
$server->setClass('ServerClass'); 
$server->handle(); 
$response = ob_get_clean(); 
echo $response; 

一旦物业的mustUnderstand = 1,那么我从服务器变成例外:标题不明白。

  1. 如何理解标题?
  2. 如何在SoapServer端进行WSSE验证?

回答

0

该解决方案非常棘手!我不知道这是为什么从SoapServer的这种方法处理,但这里是解决方案:

class ServerClass { 

    public function Security($data) { 
     // ... do nothing 
    } 

    public function myFunction(){ 
     // here the body function implementation 
    } 
} 

我们需要在我们班,这是处理与的名称的SOAP请求定义函数标题标记,它持有soap:mustUnderstand属性。该功能不需要以某种方式实现。

就这样!