3
SOAP를 사용하여 .NET에서 작성된 웹 서비스와 통신해야합니다. 이 웹 서비스에는 인증서와 사용자/암호가 포함 된 ws-security 인증이 필요합니다. 인증은 다음과 같이 정의됩니다.PHP SOAP ws-security
<security mode="Message">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
PHP 용 ws-security를 구현하는 라이브러리가 있습니까? 또는 어딘가에 PHP의 SoapClient를 사용하여 이것을 구현하는 좋은 예제를 찾을 수 있습니까? 내가 찾은 모든 UserNameToken
에서만 작동 코드 조각입니다 :
$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$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);
$this->soapClient = new \SoapClient('<wsdlurl>',array());
$this->soapClient->__setSoapHeaders($headers);
그러나
The security context token is expired or is not valid. The message was not processed.
슬프게도 NuSoap은 WS 보안을 지원하지 않습니다. – Timur
아, 죄송합니다. 나는 생각했습니다. ( – Billy2mates
https://code.google.com/p/wse-php/source/browse와 같은 것입니다. /soap-wsse.php는 속임수입니다. X509 키 등을 지원합니다. – Timur