创建Springboot Web服务SOAP客户端

时间:2017-04-15 19:34:44

标签: web-services soap spring-boot

我正在创建一个简单的Springboot应用程序(1.5.2),它依赖于springboot-starter-web-services

我有需要使用的服务的WSDL,并使用wsimport生成了所有类。我注意到的一件事是生成的类包括一个包含所有远程方法和接口的接口。他们的注释。

我的问题,我应该使用这个界面吗?如果是这样,我如何配置弹簧使用它?

我跟着Springboot tutorial found here但是没有看到这个生成的接口类在任何地方提到过。我尝试像教程所说的那样调用web服务,但是我收到了错误,例如"未找到的操作的端点引用(EPR)是" http://mydefaulturi.com"和WSA行动="

生成的界面具有webservice支持的所有方法以及一些注释,例如@WebMethod@WebResult@RequestWrapper& @ResponseWrapper。我怀疑在发出请求时客户端需要这些注释,但我没有使用此接口。

1 个答案:

答案 0 :(得分:0)

我按照此处的Springboot教程进行了操作,但未在任何地方看到此生成的接口类。

Springboot tutorial found here下面的行,使用WSDL生成的类(GetQuote和GetQuoteResponse)。

In this method, both the GetQuote and the GetQuoteResponse classes are derived from the WSDL and were generated in the JAXB generation process described in the previous step. 

我应该使用此界面吗?

我想是的。在示例中,类将在hello.wsdl包下生成Generate domain objects based on a WSDL包下生成。它使用jaxb2 plugin,您正在使用wsimport。两者都应该正常工作。

希望这会对你有所帮助。

(如果您可以提供类似于您的实现的一些客户端和配置类,将会很有帮助)