想创建一个WSS头authentificate担保网络服务。
我可以用一个丑陋的做到这一点:
$auth = '
<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp wsu:Id="Timestamp-28" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>' . $timestamp . '</wsu:Created>
<wsu:Expires>' . $timestampExpires . '</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-27" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>' . $user . '</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' . $passdigest . '</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">' . $encodedNonce . '</wsse:Nonce>
<wsu:Created>' . $timestamp . '</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>';
现在我试图做到这一点清洁剂,使用SimpleXML。
但是,如果我尝试做一个简单的:
$xml = new SimpleXMLElement('<wsse:Security/>', 0, false, 'wsse');
我得到:
警告:的SimpleXMLElement :: __结构()的SimpleXMLElement .--构建物]:命名空间错误:在安全命名空间前缀WSSE没有定义
我想我会错过一些与创建命名空间的个XML的方式,你可以给我一些提示?