How to call/test a web service from a browser

Web service testing FAQ: How can I test a web service from a browser?

There was a time in my life when all I did was write and test web services, and here are a few notes I learned about hitting one of my web services from a browser.

Looking at the WSDL for a web service from a browser

To view the WSDL document for a web service I created named UserService, I just went to the following URL in my browser:


For my purposes I’m running the web service using the Axis2 server (as opposed to running it through Tomcat, Glassfish, or other), so my UserServiceweb service is available at that URL.

Calling a web service SET method from a browser

To call a method on my web service named setTwoNumbers, which shows up in the WSDL as setTwoNumbers(int param0, int param1), I typed this as a URL in my browser:


Calling a web service GET method from a browser

After first calling my method to set the two parameters, I was then able to call these two methods and get my numbers (5 and 10) back from them:



While this tip works just fine when you're using Axis or Axis2, it does not work if you’re using XFire. There are other ways to test XFire web services from tools like Eclipse, but personally I like the browser approach as a quick test. I hope you can use this same browser-based technique to test your web services with whatever server-side tool you’re using.

If you’re a command-line user, you may also like my How to test web services using Curl commands tutorial.