Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Basic Authentication with an Axis2 ADB Client?

Tags:

java

axis2

I'm trying to figure out how to do Basic Authentication with an ADB Axis2 version 1.5 Client.

I'm trying the following:

HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername(username);
basicAuth.setPassword(password);
final Options clientOptions = serviceStub._getServiceClient().getOptions();
clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);

However this does not work and the needed line in the message header is not being added.

like image 954
Mike C. Avatar asked Oct 06 '09 21:10

Mike C.


People also ask

How do you consume Java SOAP Web services using Axis2 client?

All you need to do is create a new "Dynamic Web Service Project" in a RAD Workspace. Then import your wsdl file to this Project. Then, right click on that file, and select Webservices ---> Generate Client. This would allow you to configure parameters like WS Runtime which can be set to Apache Axis here.

Where can I find Axis2 XML?

The document is all about the proper way of specifying the configurations in axis2. xml, which is located at AXIS2_HOME/conf. There are six top level elements that can be seen in the configuration file inside the root element, <axisconfig name="AxisJava2.

What is Axis2 server?

Apache Axis2™ is a Web Services JSON / SOAP / WSDL engine, the successor to the widely used Apache Axis SOAP stack. There are two implementations of the Apache Axis2 Web services engine - Apache Axis2/Java and Apache Axis2/C.


1 Answers

Got the answer from the following site:

http://www.inpc.de/blog/2007/05/axis2-12-basic-authentication.html

Apparently I was missing:

basicAuth.setPreemptiveAuthentication(true);
like image 78
Mike C. Avatar answered Oct 07 '22 18:10

Mike C.