Php ile sabun güvenlik başlığı ekleme

2 Cevap

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);

Ama şu durum geri almak:

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

Ben burada yanlış ne yapıyorum? Bilmem gereken eksik bir bilgi var mı?

2 Cevap

Sen (SSL üzerinden varsayıyorum?) Düz metin parola gönderiyor, ancak web hizmeti de bir nonce gerektirir.

Aynı sorun ile ilgili gibi görünüyor olarak bu tartışma bakınız: http://wso2.org/forum/thread/5304

PHP ile WS-Security için çeşitli yaklaşımlar çalışırken çok zaman geçirdim.

Sonunda olağanüstü bir çözüm özetliyor bu research paper by IBM tökezledi. Şimdi bizim web servisi ile yüksek hacimli entegrasyon için onu kullanıyorlar.