• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ERROR in WebService AXIS2

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!


 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRAnch.

A 401 error means that the target URL is protected, and you need to provide username/password authentication.
 
Rossella Osso
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok thanks! i will set psw in the client and i will tell you the result!
thank you!!
reply
    Bookmark Topic Watch Topic
  • New Topic