I\'m having some trouble setting the HTTP Authorization header for a web service request using Apache CXF. I have my client setup through spring:
If you are looking to externalize the client and authentication best approach is to setup httpConduit in spring context..
**in your spring context file...**
file:${config.dir}/application.properties
...
...
applicaiton.properties
---------------------
webservices.http.auth.username=userName
webservices.http.auth.password=Password
webservice.soap.address=https://your.service.url/services/service
a) by mentioning the SOAP Address in the name attribute. which your can find in your WSDL
Ex: if in your WSDL..
...
Then
...
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"
...
${webservices.http.auth.username}
${webservices.http.auth.password}
Basic
Or b) name attribute should be {targetNamespace}portName.http_conduit
${webservices.http.auth.username}
${webservices.http.auth.password}
Basic