2

I apologize in advance if this is a duplicate, I'v searched for hours and can't find anything.

I'm attempting to connect to a SOAP-based web service that provides a WSDL via a Java (specifically Tomcat) application. I've done this in .Net before and it couldn't have been easier. I simply clicked "Add Web Reference" and pointed it to the WSDL and it generated all of the stubs and marshaling/unmarshaling code for me. I've heard of XJC and that seems promising although I can't seem to find anything recent about it (everything is from 2002ish and seems to have broken links galore). I found one tutorial where they manually generated the SOAP XML but that just seems so much more inefficient than it needs to be. Will XJC do what I'm looking for? (That is, generate the class stubs along with code to marshal and unmarshal my requests) If so, can you suggest a tutorial/documentation?

Thanks in advance!

6 Answers 6

2

I've had the best luck with Eclipse. Go to "New" -> "other". Then in "Web Services" choose "Web Service Client". Put the slider on "Deploy Client" and point it at your wsdl and it should generate usable client code.

Sign up to request clarification or add additional context in comments.

Comments

2

Chris, try the standard first - JAX-WS. Scroll down for the client: http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/2.0/tutorial/doc/JAXWS3.html

Comments

0

Try a Java IDE, such an Eclipse. All the ones that I know of have webservices tooling like you describe in Visual Studio. If you choose Eclipse, make sure to go with Eclipse IDE for Java EE developers package.

Comments

0

You might also look at Spring web service module. It makes generating a client pretty simple.

IntelliJ from JetBrains will also generate a client from a WSDL for you.

1 Comment

I actually had found this documentation before and as I'm using spring anyway, this seemed like a natural choice. However both before and now when I read through it again, I can't seem to find anything about generating stub client code. I went ahead and got eclipse to do it for me but I'm sure it's there and I'm just bleary eyed...Thanks!
0

What you should do is use a JAX-WS implementation. Most IDEs (Netbeans, Eclipse, IntelliJ IDEA) have similar tools to the .Net ones you are used to. You can also do it from the command line (just like the .Net wsdl.exe version).

If you go for Netbeans it will be using the default Jax-WS implementation that comes with it (Metro). A very good alternative to this is Apache CXF (http://cxf.apache.org/).

CXF provides a command line tool wsdl2java which does exactly the same thing you're saying, it generates stubs (Java classes) for the WSDL you give it. http://cxf.apache.org/docs/wsdl-to-java.html

Comments

0

As stated by jbx, a JAX-WS implementation is a good choice. An alternative to Apache CXF is Axis 2.

Possibly out of scope, but if you are using Java and are interested in agile web development, Grails (Groovy) could be of interest. It lets you do old-style java code or groovy code or both, very handy. It has some "magic" stuff to help you out as well.

Grails works fine with Apache CXF, but also has some very easy-to-use libraries like GroovyWS.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.