12

I used eclipse Helios to create a Web Service Client for consuming an axis 1.4 web service.
It generated 2 packages:
1 - datamodel.
2 - client.

Inside client package there are 5 classes:
1- ServiceName
2- ServiceNameProxy
3- ServiceNameService
4- ServiceNameServiceLocator
5- ServiceNameSoapBindingStub

I need to Know what are these ? AND
How to call the web service methods with parameters?

Thanks in advance

Abu Muhammad
  • 1,185
  • 5
  • 20
  • 29

1 Answers1

15

I am very new to Web Services and I can't give a good explanation of what those classes are, but, I believe you can use the Proxy class to call the Web Service methods.

public class TestClient{
    public static void main(String []args){
        ServiceNameProxy proxy = new ServiceNameProxy();
        proxy.setEndpoint("http://localhost:8080/ServiceName/asdf");//defined in wsdl

        int i = proxy.webServiceMethod(new String(), new String());
    }
}

webServiceMethod() would be whatever the name of the method is defined in the service.

lhan
  • 4,585
  • 11
  • 60
  • 105
bmeding
  • 617
  • 7
  • 14
  • how to handle authentication when using proxy I used stub and can set username and password – Abu Muhammad Nov 11 '10 at 16:38
  • 1
    @Fahad please use punctuation.. I can't understand your comment – bluish Aug 31 '11 at 08:09
  • I had the same interrogation. Hey, Eclipse and Axis people, the generated Java classes miss Javadoc ! This answer works ! And the code is simple. :-) I was a little puzzled by the `setEndpoint` line, so let me precise this. The address passed here is the Web Service's address, not the address of the WSDL. The "asdf" bit and the comment `defined in wsdl` create more confusion than explanation. – Nicolas Barbulesco Apr 05 '13 at 16:46