Lets' go step by step

  1. After creating your web service in SAP, open wsadmin transaction.
  2. Find your web service and press Ctrl+F1 after selecting your service.
  3. Just click OK to new window
  4. In browser your web service will be shown as xml type document*
  5. Copy all the text in the window
  6. Open a new project in Eclipse and create a text(*.txt) file
  7. Insert copied text to this text file and save it.
  8. Rename file extension to wsdl (*.wsdl), you will see the change in icon
  9. Right click new wsdl file and click Web Services -> Generate Client
  10. Eclipse will generate the required classes to invoke the web service
  11. Create a Java class with main method. Assume that my web service name is Z_Customers and method name is getCustomers()
  12. In the main method copy the following I hope you will not face any difficulties

try{

     //Creates new service from locator
     Z_CustomersService service = new Z_CustomersServiceLocator();
     System.out.println("!service called!");

     //Kna1 is a Customer table of SAP, in my web service
     //I just select the customer from this table. This class also
     //generated by eclipse.
     Kna1[] customers = new Kna1[100];

     //Binding the web service
     Z_Customers binding = service.getz_customersSoapBinding();
     System.out.println("!service binded!");

     //Tables are changeable (import/export) type in SAP so
     //I have to give my table as a parameter and assign the result.
     customers = binding.GetCustomers(customers);

     for(int i=0; i<tcustomers.length; i++){
          System.out.println(customers[i].getName());
     }
} catch(RemoteException e){
     e.printStackTrace();
} catch (ServiceException e) {
     e.printStackTrace();
}

* Some browsers does not show, right click and view the source.