For reasons unbeknownst to me, I need to declare a SOAP namespace in a particular element for this request to work. So, instead of defining wsse in the Envelope element:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <SOAP-ENV:Header> <wsse:Security SOAP-ENV:mustUnderstand="1"> <wsse:Usernametoken wsu:Id="ID-f0ebb0c1-631e-470a-8552-393e180b4cf9"> <wsse:Username>session</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">nosession</wsse:Password> </wsse:Usernametoken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body/> </SOAP-ENV:Envelope> I need to define it in the Security element:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"> <wsse:Usernametoken wsu:Id="ID-f0ebb0c1-631e-470a-8552-393e180b4cf9"> <wsse:Username>session</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">nosession</wsse:Password> </wsse:Usernametoken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body/> </SOAP-ENV:Envelope> But I can't declare the Security element to add the wsse namespace if that element NEEDS the namespace to exist. What should I do? My (nonfunctional) code looks like:
SOAPElement header = envelope.getHeader(); SOAPElement security = header.addChildElement("Security","wsse"); security.addNamespaceDeclaration("wsse","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); security.setAttribute("SOAP-ENV:mustUnderstand", "1");
No comments:
Post a Comment