java 是否可以使用 Spring-WS 从 WSDL 文件创建 WS 客户端?(好像没有)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13803977/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 14:02:22  来源:igfitidea点击:

Is it possible to create a WS-client from WSDL file using Spring-WS? (It seems not)

javaspringwsdlspring-ws

提问by jbbarquero

I'd like to know if it's possible to create Web Services client from a WSDL file using Spring Web Services.

我想知道是否可以使用 Spring Web Services 从 WSDL 文件创建 Web 服务客户端

I mean from the very WSDL, I don't have any XSD for the time being.

我的意思是从 WSDL 开始,我暂时没有任何 XSD。

But I've read Josh Long's "Spring Recipes A Problem-Solution Approach", Hamidreza Sattari's "Spring Web Services 2 Cookbook" and the tutorial itself (6. Using Spring Web Services on the Client) and there's no reference to this feature.

但我已经阅读了 Josh Long 的“Spring Recipes A Problem-Solution Approach”、Hamidreza Sattari 的“Spring Web Services 2 Cookbook”和教程本身(6. 在客户端上使用 Spring Web 服务),但没有提及此功能。

I've also read other posts, like Webservice-Client: Common approach with Spring WS, JAXB and just one WSDL file?, or Spring-ws client from WSDL(here at stackoverflow) but without any further results.

我还阅读了其他文章,例如Webservice-Client: Common approach with Spring WS、JAXB 和只有一个 WSDL 文件?,或来自 WSDL(在 stackoverflow 上)的Spring-ws 客户端,但没有任何进一步的结果。

I've even asked the question at Spring forums, but no responses after more than 60 reads: Is it possible to create a WS-client from WSDL file using SWS? (It seems not)

我什至在 Spring 论坛上问过这个问题,但在阅读 60 多篇之后没有任何回应:Is it possible to create a WS-client from WSDL file using SWS? (好像没有)

Maybe it's not possible.

也许这是不可能的。

Thanks.

谢谢。

回答by Biju Kunjummen

You can do it this way:

你可以这样做:

  1. Generate your java types using the xjc tool that comes with the JDK distributions - xjc -wsdl file.wsdl

  2. Then using the generated java types, use WebserviceTemplate, described hereto create the client.

  1. 使用 JDK 发行版附带的 xjc 工具生成您的 java 类型 - xjc -wsdl file.wsdl

  2. 然后使用生成的java类型,使用WebserviceTemplate,这里描述的创建客户端。