Search code examples
javaweb-servicesapache-axis

how can i debug this issue with axis 2 web services and clients


I am learning to make web services with eclipse, apache and axis 2 following this tutorial. I am able to generate web services, create and upload .aar files and generate web service clients just like in the tutorial. But when I go to test the client it is not generating proper responses...

 PersonalInfoServiceStub stub = new PersonalInfoServiceStub();
 GetContactInfo atn = new GetContactInfo();
 atn.setPersonID(1);
 GetContactInfoResponse c = stub.getContactInfo(atn);
 System.out.println(c.get_return()); //returns null

 // The Java Class that serves as the basis for the web service works well...
 PersonalInfoService s = new PersonalInfoService(); 
 System.out.println(s.getContactInfo(1).getStreet()); //returns main street

This is all very new for me (I am still pretty dependent on following the tutorial) so I am not sure what might be causing this issue or how I might go about debugging what's wrong. What might be causing the problem and how would I go about debugging it?

If I try to call the webservice in the broswer using this url: http://localhost:8080/axis2/services/PersonalInfoService/getContactInfo?personID=1 I get this

This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <ns:getContactInfoResponse xmlns:ns="http://webservices.com">
    <ns:return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    </ns:getContactInfoResponse>

Solution

  • It looks like your client code is okay. The response from the server just doesn't contain any data. The simplest explanation is that the server sent back a response without any data. If I were you, I'd troubleshoot the server's behavior when it receives this request, rather than focusing on the client code.