0

I am using Axis2 for generate code from wsdl. I can call soap service via stub class and it is ok. But i have to send soap header like below. How can i do this?

<wsse:Security soapenv:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-6"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile- 
1.0#PasswordText">password</wsse:Password>
<wsse:NonceEncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message- 
security-1.0#Base64Binary">randomnaumber==</wsse:Nonce>
<wsu:Created>dateCreated</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
erdem
  • 1
  • 1

1 Answers1

0

You need to configure Web service security (WSS4J) Interceptors (both client and server side) to enable username, password authentication. So that you could send headers like you mentioned. Either you could create a configuration class or use xml based configuration.

Gowtham
  • 31
  • 3
  • How can i use wss4j and add nonce value to this? – erdem Jul 08 '20 at 09:54
  • All those can be configured using WSS4J Interceptors. A detailed explantion can be found in official documentation of Apache WS WSS4J Project. Follow [Here](https://ws.apache.org/wss4j/using.html) – Gowtham Jul 08 '20 at 13:17