开发者

expose JAXB generated Class as WSDL web service

I have a bunch of very simple functions. Each function has one input and one output.

OutputType function func(InputType);

The types of input/output are defined in xsd schema and generated into java classes with JAXB/XJC. Now I wan开发者_JAVA百科t to expose those functions as WSDL Web service running on Geronimo.

I just took a look at Axis/WSDL2Java/Java2WSDL; I thought that is pretty in a similar way as my functions are created.

I guess, I can use Java2WSDL to generate WSDL from my function and input/output types. and then use some tools to generate server/client side binding,

Can anyone give more further suggestions? especially I have defined my input/output of functions in a xsd schema.

thanks very much.

A Summary:


These are what I have now....

Many implemented functions with one input and one outout.

public OutputType functionXXX(InputType in) { ....; return output; }

InputType and OutputType are already defined in a xsd schema (and turned into java classes with Jaxb/xjc).


What I want is....

Build Web services to execute those functions. Not to touch the code of implemented functions. And with WSDL,


I found a tutorial using CXF to do what you are looking to here.

That document claims to be using a contract first approach, but it isn't exactly. When discussing SOAP-based services, contract first means creating the descriptors (WSDL, XSD) first. You then generate any code artifacts from those descriptors. You can see the comments in the original blog post for the debate about the original author's choice of words.

That being said, a contract first approach has many benefits depending on what you are trying to accomplish. See the Spring Web Services tutorial for some information about it.


If you have an existing schema, with existing JAXB2 bindings for it, then in my experience Spring WebServices is by far the easiest way of exposing that as a SOAP web service. Its philosophy is "contract first", which is is exactly what you have. You don't need to generate any additional bindings, just wire up the endpoints a la Spring MVC, plug in the marshaller, and of it goes. It will introspect your schema looking for things that look like operations and expose them as WSDL operations automatically (you can tell it how to do that, if the default auto-discovery doesn't quite work).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜