GeeCON Prague 2014*
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
Author

ERROR in WebService AXIS2

Rossella Osso
Greenhorn

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();

c2f.setCValue(c_value);

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

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



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

f2c.setFValue(res.get_return());

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

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

} catch (AxisFault e) {

e.printStackTrace();

} catch (RemoteException e) {

e.printStackTrace();

}

}

}


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


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
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
Greenhorn

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
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
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
Greenhorn

Joined: Sep 16, 2009
Posts: 3
ok thanks! i will set psw in the client and i will tell you the result!
thank you!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ERROR in WebService AXIS2