WSSE Security PHP SoapServer- Header not understood

Mut*_*tos 1 php soap-client soapserver

I have a client call with a WSSE Security Header:

<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>
Run Code Online (Sandbox Code Playgroud)

As SoapServer I have a simple one:

// 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;
Run Code Online (Sandbox Code Playgroud)

As soon the property MustUnderstand = 1, then I become from the server the exception: Header not understood.

  1. How to understand the header?
  2. How to make the WSSE validation on the SoapServer side?

Mut*_*tos 5

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

class ServerClass {

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

    public function myFunction(){
        // here the body function implementation
    }
}
Run Code Online (Sandbox Code Playgroud)

我们需要在我们的类中定义一个函数,它处理带有标头标签名称的soap请求,该标头标签持有soap:mustUnderstand属性。该功能不需要以某种方式实现。

就这样!