O'Reilly logo

Java Web Services: Up and Running by Martin Kalin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The wsgen Utility and JAX-B Artifacts

Any document-style service, wrapped or unwrapped, requires the kind of artifacts that the wsgen utility produces. It is time to look again at this utility. A simple experiment underscores the role that the utility plays. To begin, the line:

@SOAPBinding(style = Style.RPC)

should be commented out or deleted from the SEI ch01.ts.TimeServer. With this annotation gone, the web service becomes document style rather than rpc style. After recompiling the altered SEI, try to publish the service with the command:

% java ch01.ts.TimeServerPublisher

The resulting error message is:

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException:
runtime modeler error: Wrapper class ch01.ts.jaxws.GetTimeAsString is not found.     

The message is obscure in citing the immediate problem rather than the underlying cause. The immediate problem is that the publisher cannot find the class ch01.ts.jaxws.GetTimeAsString. Indeed, at this point the package ch01.ts.jaxws that houses the class does not even exist. The publisher cannot generate the WSDL because the publisher needs Java classes such as GetTimeAsString to do so. The wsgen utility produces the classes required to build the WSDL, classes known as wsgen artifacts. The command:

% wsgen -keep -cp . ch01.ts.TimeServerImpl

produces the artifacts and, if necessary, the package ch01.ts.jaxws that houses these artifacts. In the TimeServer example, there are four messages altogether: the request and response ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required