I use a Maven plugin (org.codehaus.mojo
> axistools-maven-plugin
) + a WSDL file to generate a Soap Web Service.
Genarated files in target/generated-source/wsdl2java/com.comp.proj are:
In my project, i create FooSoapBindingImpl.java
in a package with the same name + add my custom code in this java implementation.
This Web services is ready for use in production.
So, today I add Basic authentication on my client (header => Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==)
How to add a check on this Basic authentication in my Axis Web Service?
The basic authentication is encoded in the HTTP request that carries the SOAP message. When the application server receives the HTTP request, the user name and password are retrieved and verified using the authentication mechanism specific to the server. Use transport-level security to enable basic authentication.
The "Axis security section 'Authenticating the caller'" mentions:
Clients can authenticate themselves with client certificates, or HTTP basic authentication.
The latter is too weak to be trustable on a non-encrypted channel, but works over HTTPS.The
MessageContext
class will be configured with the username and password of the sender when SOAP messages are posted to the endpoint;*
See an example here.
use the appropriate getters to see these values. Note that Axis does not yet integrate with the servlet API authentication stuff.
See a getter example in this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With