【问题标题】:Spring Web Service Client Architecture and Design SuggestionsSpring Web Service 客户端架构和设计建议
【发布时间】:2023-04-07 17:34:01
【问题描述】:

我的任务是创建一个 Web 服务客户端,该客户端将访问基于 SOAP 的第三方 Web 服务。

我们的原始程序员使用 Apache Axis 来访问 Web 服务。他基本上必须根据 WSDL 文件生成 POJO 类。

我将改用 Spring WS 来实现客户端 Web 服务。我看过例子。我没有接触任何 Apache Axis 的东西。有人可以告诉我我将要实现的客户端的架构和设计吗?

这是我打算做的:

1. Get a copy of the WSDL
2. Generate the POJO classes based on WSDL
3. Implement the web service client using Spring web service template.
4. Use the POJO classes to contain the data that I will be sending, manipulating, and receiving. A marshaller/unmarshaller will do the conversion from XML to Object and vice versa

要从 WSDL 文件生成 POJO 类,我应该使用什么程序或 jar?

另外,SAAJ 和 Apache 的 AXIOM 有什么区别?我知道我会使用其中之一。

【问题讨论】:

    标签: spring architecture service wsdl


    【解决方案1】:

    如果您正在实现一个 SOAP Web 服务客户端,那么您需要一个用于将 XML 编组为一些 POJO 对象的工具。看看 Jax-WS ri 和 JaxB。两者都与 Spring Web 框架和 Spring-WS 兼容。您需要使用上述工具之一创建存根。更多信息请阅读thisthis

    【讨论】: