User136609187 posted
I am trying the create the below xml structure through code using xml document
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameTokenSYS-20167">
<wsse:Username>Test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">INjMj38s6P64XdT1Mq+DPw4Q=</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
but facing some issues while creating
this node <wsse:UsernameToken wsu:Id="UsernameTokenSYS-20167"> not able to add
"wsu:Id="UsernameTokenSYS-20167"
and <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">ZCvINjMj38s6P64XdT1Mq+DPw4Q=</wsse:Password>
and to also to append the "soapenv:mustUnderstand="1" to the root Security Node.
This is the code which i tried...
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("wsse:Security", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
root.SetAttribute("xmlns:wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
XmlElement id = doc.CreateElement("wsse", "UsernameToken");
id.SetAttribute("wsu:Id", "UsernameTokenSYS-20167");
Please could you help me out here