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
Is it possible to create a WS-client from WSDL file using Spring-WS? (It seems not)
提问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:
你可以这样做:
Generate your java types using the xjc tool that comes with the JDK distributions -
xjc -wsdl file.wsdl
Then using the generated java types, use WebserviceTemplate, described hereto create the client.
使用 JDK 发行版附带的 xjc 工具生成您的 java 类型 -
xjc -wsdl file.wsdl
然后使用生成的java类型,使用WebserviceTemplate,这里描述的创建客户端。