Friday, October 14, 2011

Web Service Client - Eclipse

                                                      Web Service Client - Eclipse


  1. Now we'll generate the client for the newly created service by referring the ?wsdl generated by the Axis2 Server. Open File -> New -> Other... -> Web Services -> Web ServiceClient



  2. Paste the URL that was copied earlier into the service definition field.

  3. Click on the Client project hyperlink and enter Axis2WSTestClient as the name of the client project. Click OK.


  4. Back on the Web Services Client wizard, make sure the Web service runtime is set to Axis2 and the server is set correctly. Click Next.



  5. Next page is the Client Configuration Page. Accept the defaults and click Finish.



  6. The Clients stubs will be generated to your Dynamic Web project Axis2WSTestClient.



  7. Now we are going to write Java main program to invoke the client stub. Import the ConverterClient.java file to the workspace into the wtp package in the src folder of Axis2WSTestClient.



  8. Then select the ConverterClient file, right-click and select Run As -> Java Application. Here's what you get on the server console:


    If it give endpoint exception, you can replace the code with as under
StudentWS_ServiceLocator service = new StudentWS_ServiceLocator();
            StudentWS_PortType port = service.getStudentWSPort();
            port.setStudentData(std); 

    No comments:

    Post a Comment

    Blog Archive