Testing the service

  • Now to test the service , we will run the java client class we created earlier.
  • Run the java client class in eclipse
  • In console window , we should see the output of System.out.print , as in our case result should be
ChiragTestSuccess

We created the our first Web Service , Such a easy job Isn't it? :)

11 comments:

  1. nice and useful instruction. Thanks

    ReplyDelete
  2. there are more errors in your example
    1.TestService should be interface
    2.TestServiceStub.ServiceFunctionResponse res = stub.serviceFunction(obj);
    TestServiceStub.DataBean data=new TestServiceStub.DataBean();

    How you will access the methods in the above step

    ReplyDelete
  3. I dont any reason why testservice should be a interface .......class is ok ....its just a example to show a service side ...its not a genric thing .....

    please see this for syntax to access methods :
    http://websaxis2tut.blogspot.com/2010/05/writing-java-client-general.html

    once u get the data in databean usit get_return() u can use normal java syntax to access methods of databean .

    ReplyDelete
  4. have you tried sending object from client to server?
    Returning object from server to client works fine, but i am getting error on passing object from client to server.

    Any special instructions?

    ReplyDelete
  5. Found your website perfect for my needs. It contains wonderful and helpful posts. I have read most of them and learned a lot from them. You are doing some great work. Thank you for making such a nice website.

    Web Services

    ReplyDelete
  6. Nice writing. I think your website should come up much higher in the search results than where it is showing up right now...

    ReplyDelete
  7. Hi,

    Very nice article.
    I also worked on this but in different way..

    check out this link: vishalbolgger.blogspot.in

    cheers

    ReplyDelete
  8. Hi.. i am facing a problem after following this tutorial. I am getting an exception:
    org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {webservice1/types}name
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at webservice1.TestDynamicServiceStub.fromOM(TestDynamicServiceStub.java:514)
    at webservice1.TestDynamicServiceStub.getLongest(TestDynamicServiceStub.java:193)
    at webservice1.TestDynamicServiceClient.main(TestDynamicServiceClient.java:22)
    Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement {webservice1/types}name
    at webservice1.xsd.DataBean$Factory.parse(DataBean.java:656)
    at types.webservice1.GetLongestResponse$Factory.parse(GetLongestResponse.java:422)
    at webservice1.TestDynamicServiceStub.fromOM(TestDynamicServiceStub.java:508)
    ... 2 more
    Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement {webservice1/types}name
    at webservice1.xsd.DataBean$Factory.parse(DataBean.java:650)
    ... 4 more


    ...when I run the client code. Also, my client code is a bit different that yours as things might have changed from Codegen v1.4 to Codegen v 1.6 (which am using). I used the TCP/IP Monitor in eclipse to monitor the request and response, they seem fine to me. What could be the prob ? Can you please help ? Thanks ! -Mandeep

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Hi Mandeep Singh,
    Did you get any solution for your problem?
    I am also getting same error..
    org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {webservice1/types}name...
    ....

    ReplyDelete
  11. Hi Mandeep Singh,
    Did you any solution for your problem?
    I am also getting same error..
    org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {webservice1/types}name...
    ....

    ReplyDelete