我需要使用Web服务,该服务需要绿洲安全标头,其中包含用户名令牌,用户名和密码,如下所示-
<soapenv:Header>
<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="">
<wsse:Username>xxxxx</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"xxx</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">xxxxxxxx</wsse:Nonce>
<wsu:Created>2018-09-29T20:10:34.377Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
我有WSDL,并且已经使用Gradle JAXB插件创建了Java类。我现在正在寻找一种在调用Webservice之前在soap消息中添加以上安全标头的方法。请指教。