views:

124

answers:

3

Hi there,

Anybody aware of how to call a webservice from Java, whats the recommended way, do i need to download an additional JAR or something?

Anybody know of a good tutorial.. i saw something ksoap but it seems pretty old??

The webservice is actually hosted by WCF on .net but i shouldn't think this makes a difference...

I was hoping to use something out of the box?

Any help really appreciated

Thanks

+1  A: 

Java 6 includes all you need to act as a web service client without adding new libraries. You can use the wsgen tool to generate Java classes from a WSDL file (web service descriptor) and then use these classes from your own Java program.

jarnbjo
+2  A: 

Jax-ws comes bundled with the JDK so this would be the easiest path for you.

There are tons of tutorials for building jax-ws clients e.g.

http://java.sun.com/javaee/5/docs/tutorial/doc/bnayn.html

If you're using spring etc I would recommend CXF,

http://cxf.apache.org/

hth

ste

sgargan
+2  A: 

This blog entry details how to create a client using Java 6 and the WSDL file. To quote:

To generate the stub (service and interface) we use the wsimport tool, use the following command to generate the required files:

wsimport -keep http://localhost:8080/calc?wsdl

Brian Agnew