I have been tasked with rewriting a .NET application which communicates using a WSE Proxy to PHP.
There is one thing I'm grappling with. I see the code
UsernameToken userNameToken1 = new UsernameToken(sToken_UserName, sToken_Password, PasswordOption.SendPlainText);
Which, I assume, adds a security header to the SOAP envelope. I am not sure how to do this in PHP. I tried the following snippet which I found online somewhere
$token = new stdClass;
$token->Username = new SOAPVar($username, XSD_STRING, null, null, null, $ns);
$token->Password = new SOAPVar($password, XSD_STRING, null, null, null, $ns);
$wsec = new stdClass;
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns);
$headers = new SOAPHeader($ns, 'Security', $wsec, true);
$client->__setSOAPHeaders($headers);
But I get the following exception back:
Uncaught SoapFault exception: [SOAP-ENV:Client] com.sun.xml.wss.XWSSecurityException: Receiver Requirement for nonce has not been met; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.XWSSecurityException: Receiver Requirement for nonce has not been met
What am I doing wrong here? Is there missing information that I need to know?