Calling a webservice from wsdl in java code

447 views Asked by At

I am new in working with web services.I have got this WSDL file URL

**http://localhost:7101/MyWebServices-Webservices-context-root/ThePort?WSDL**

I know there are tools to call method from this web service just like HTTP ANALYZER. I want to user above url to call method from the web service from java code. can i do that? if yes can someone please guide me how to?? Thanks. . . .

This is what i am trying

URL url = new URL("http://localhost:7101/MyWebServices-Webservices-context-root/ThePort?WSDL");
            QName qname = new QName("http://example.com/", "HelloWorldService");
            Service service = Service.create(url, qname);
1

There are 1 answers

0
Rhys Hamilton On

If you are using the Eclipse IDE, the JavaEE perspective provides a suitable environment for developing web services and their clients.

Right-click the Project Explorer > New > Other > Web Service Client.

The Web Service Client window should appear. In the 'Service Definition' box, paste the WSDL file. If the file is valid, you should be able to create a client application where you will be able to call and execute the appropriate methods.