The moose likes Web Services and the fly likes ERROR in WebService AXIS2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "ERROR in WebService AXIS2" Watch "ERROR in WebService AXIS2" New topic

ERROR in WebService AXIS2

Rossella Osso

Joined: Sep 16, 2009
Posts: 3
Hi, I created a Web Service and I used Axis2.
I have generate all classes ( skeleton, stub) but when i try to run my client i have this problem:

org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:296)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:190)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:364)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:208)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at ws.example.TemperatureConverterStub.c2FConvertion(TemperatureConverterStub.java:463)
at ws.example.TemperatureConverterServiceClient.main(TemperatureConverterServiceClient.java:63)

i don't understand why
i post you the code of my client :

import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;


* Client for Temperature Converter Service


public class TemperatureConverterServiceClient {

public static void main(String[] args) {

TemperatureConverterStub stub;

try {

double c_value = 32;

stub = new TemperatureConverterStub ("http://localhost:8080/axis2/services/TemperatureConverter");

TemperatureConverterStub.C2FConvertion c2f = new TemperatureConverterStub.C2FConvertion();


TemperatureConverterStub.C2FConvertionResponse res = stub.c2FConvertion(c2f);

System.out.println("C Value : "+c_value+ "\tResult : " +res.get_return());

TemperatureConverterStub.F2CConvertion f2c = new TemperatureConverterStub.F2CConvertion();


TemperatureConverterStub.F2CConvertionResponse res1 = stub.f2CConvertion(f2c);

System.out.println("F Value : "+res.get_return()+ "\tResult : " +res1.get_return());

} catch (AxisFault e) {


} catch (RemoteException e) {





please help me!! is very important!! thanks!!!

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41111
Welcome to JavaRAnch.

A 401 error means that the target URL is protected, and you need to provide username/password authentication.

Ping & DNS - my free Android networking tools app
Rossella Osso

Joined: Sep 16, 2009
Posts: 3
i have add a role in my tomcat user.xml with username e pwd.. do you think that this is the problem?? must i write somethingh in the code of my client??
please help me!! thank you very much!
ps. sorry for my english
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41111
Yes, you need to set the username and password in the client, or finetune your server settings so that the service is not protected.

Check the TemperatureConverterStub class for methods that allow you to set username/password, or check the documentation of whichever tool you're using to create those classes for more information on this.
Rossella Osso

Joined: Sep 16, 2009
Posts: 3
ok thanks! i will set psw in the client and i will tell you the result!
thank you!!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: ERROR in WebService AXIS2
Similar Threads
[Axis2]Transport error: 411 Error: Length Required
Axis2 client to invoke NTLM .NET WCF web services
Making a webservice call using axis2
axis2 ntlm authentication - No credentials available for NTLM
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized while invoking the webservice