我想知道是否可以使用 Spring Web 服务从 WSDL 文件创建 Web 服务客户端。
我的意思是从 WSDL 来看,我暂时没有任何 XSD。
但我读过 Josh Long 的“Spring Recipes A Problem-Solution Approach”、Hamidreza Sattari 的“Spring Web Services 2 Cookbook”和教程本身 (6. Using Spring Web Services on the Client),但没有提及此功能。
我还阅读了其他帖子,例如 Webservice-Client: Common approach with Spring WS, JAXB and just one WSDL file? , 或 Spring-ws client from WSDL (在 stackoverflow 上)但没有任何进一步的结果。
我什至在 Spring 论坛上问过这个问题,但阅读超过 60 次后仍未得到回复:Is it possible to create a WS-client from WSDL file using SWS? (It seems not)
也许这是不可能的。
谢谢。
最佳答案
你可以这样做:
使用 JDK 发行版附带的 xjc 工具生成您的 java 类型 -
xjc -wsdl file.wsdl
然后使用生成的 java 类型,使用 WebserviceTemplate,描述 here创建客户端。
关于java - 是否可以使用 Spring-WS 从 WSDL 文件创建 WS 客户端? (好像没有),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13803977/