2017-06-17 71 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屬性。該功能不需要以某種方式實現。

就這樣!