在Java中将标记添加到标题肥皂

时间:2016-02-05 11:24:36

标签: java soap http-headers token

我想通过Java向SOAP头添加安全性令牌。标题应如下所示:

<soapenv:Header>
<wsse:Security soapenv:actor="http://www.example.com/soap/actor/wssecurity" soapenv:mustUnderstand="1" S12:role="wsssecurity" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:S12="http://www.w3.org/2003/05/soap-envelope">
        <wsse:BinarySecurityToken wsu:Id="SSOToken" ValueType="esquema" EncodingType="wsse:Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">TOKEN_HERE</wsse:BinarySecurityToken>
    </wsse:Security>
</soapenv:Header>

当我需要向HTTP标头添加用户和密码时,我有这个例子:

Map<String, Object> req_ctx = ((BindingProvider)client).getRequestContext();
req_ctx.put(BindingProvider.USERNAME_PROPERTY, "user");
req_ctx.put(BindingProvider.PASSWORD_PROPERTY, "password");
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("AplicationID", Collections.singletonList("id"));
req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);

如何使用与上面代码块相同的方法将标记添加到标题中?

由于

0 个答案:

没有答案