jumpytheclown
New Member
I want to create a WSS header to authentificate on secured web services.I can do it using an ugly :\[code\] $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> <wsseassword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' . $passdigest . '</wsseassword> <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>';\[/code\]I am now trying to do it cleaner, using SimpleXML.But if I try to do a simple :\[code\] $xml = new SimpleXMLElement('<wsse:Security/>', 0, false, 'wsse');\[/code\]I get : \[quote\] warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: namespace error : Namespace prefix wsse on Security is not defined in\[/quote\]I think I miss something with the way to create namespaced xmls, can you give me some hints?