将 JAXB 生成的类公开为 WSDL Web 服务

发布于 2024-08-07 23:47:47 字数 648 浏览 5 评论 0原文

我有很多非常简单的功能。 每个函数都有一个输入和一个输出。

OutputType function func(InputType);

输入/输出的类型在 xsd 模式中定义,并使用 JAXB/XJC 生成 java 类。现在我想将这些函数公开为在 Geronimo 上运行的 WSDL Web 服务。

我刚刚看了一下 Axis/WSDL2Java/Java2WSDL;我认为这与创建我的函数的方式非常相似。

我想,我可以使用 Java2WSDL 从我的函数和输入/输出类型生成 WSDL。 然后使用一些工具来生成服务器/客户端绑定,

任何人都可以提供更多进一步的建议吗?特别是我已经在 xsd 模式中定义了函数的输入/输出。

非常感谢。

总结:


这些是我现在所拥有的......

许多实现的功能都具有一个输入和一个输出。

公共输出类型函数XXX(输入类型) { ....;返回输出; InputType

和 OutputType 已在 xsd 模式中定义(并使用 Jaxb/xjc 转换为 java 类)。


我想要的是......

构建Web 服务来执行这些功能。 不要触及已实现功能的代码。 通过 WSDL,

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 want 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,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

饮惑 2024-08-14 23:47:47

我找到了一个教程,使用 CXF 来完成您想要的操作此处

该文件声称使用合同优先的方法,但事实并非如此。在讨论基于 SOAP 的服务时,契约首先意味着首先创建描述符(WSDL、XSD)。然后,您可以从这些描述符生成任何代码工件。关于原作者选词的争论,您可以查看原博文中的评论。

话虽这么说,合同优先的方法有很多好处,具体取决于您想要实现的目标。请参阅 Spring Web Services 教程以获取有关它的一些信息。

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.

平生欢 2024-08-14 23:47:47

如果您有一个现有架构,并且具有现有的 JAXB2 绑定,那么根据我的经验 Spring WebServices 是将其公开为 SOAP Web 服务的最简单方法。它的理念是“契约第一”,这正是你所拥有的。您不需要生成任何额外的绑定,只需按照 Spring MVC 连接端点,插入编组器,然后就可以了。它将内省您的架构,查找看起来像操作的内容,并自动将它们公开为 WSDL 操作(如果默认的自动发现功能不太有效,您可以告诉它如何执行此操作)。

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文