开发者

When to use wsgen?

I'm reading up on JAX-WS at the moment.

I've successfully built JAX-WS RI services using Eclip开发者_C百科se and by hand. Both approaches make use of apt. Upon deploying my application to the app server via Eclipse or by creating a war (with or without a sun-jaxws.xml, depending on what container is being used) and deploying it manually, the JAX-WS run-time generates the appropriate WSDL automatically.

When is it useful to use wsgen?


wsgen generates response and request wrapper classes, and, as you noted, can generate a WSDL. Some containers, such as CXF, don't require these wrapper classes at all -- they generate them on the fly. Or, you might have created them for yourself, or with, I guess apt.

This link illustrates.

The JAX-WS RI provides some apt factories and recommends running APT to generate some code.

In fact, I think that http://jax-ws.java.net/nonav/2.1.1/docs/jaxws-tools.html#mozTocId344067 might be the gold standard answer to your original question.

A little expansion: JAX-WS (the standard) and JAX-WS (the reference implementation) are two different things. If you are using the RI as built into Java 1.6, or Metro, or CXF, or something else, you'll encounter different tools and requirements. In CXF, for example, for a java-first service, you don't need to run any tools at all.

Generating a wsdl from a command line might be helpful if you need to send it to someone else and you don't feel like launching the service and using the ?wsdl API.

The standard doesn't require the use of any tools, but the standard allows a standard-conforming implementation to use tools. Whew!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜