[英]Creating a Springboot Web Service SOAP client
I am creating a simple Springboot application (1.5.2) with a dependency on springboot-starter-web-services
.我正在创建一个简单的 Springboot 应用程序(1.5.2),它依赖于
springboot-starter-web-services
。
I have the WSDL for the service I need to consume and have generated all of the classes by using wsimport.我有我需要使用的服务的 WSDL,并使用 wsimport 生成了所有类。 One thing I noticed was the generated classes includes an interface with all of the remote methods & their annotations.
我注意到的一件事是生成的类包括一个带有所有远程方法及其注释的接口。
My question, should I be using this interface?我的问题,我应该使用这个接口吗? If so, how do I configure spring to use it?
如果是这样,我如何配置 spring 来使用它?
I followed the Springboot tutorial found here but do not see this generated interface class mentioned anywhere.我遵循了此处找到的Springboot 教程,但在任何地方都没有看到这个生成的接口类。 I attempted to call the webservice just like the tutorial says, but I am getting an error such as "The endpoint reference (EPR) for the operation not found is " http://mydefaulturi.com " and the WSA action ="
我试图像教程所说的那样调用 web 服务,但出现错误,例如“未找到操作的端点引用 (EPR) 是“ http://mydefaulturi.com ”和 WSA 操作 =
The generated interface has all of the methods the webservice supports as well as some annotations such as @WebMethod
, @WebResult
, @RequestWrapper
& @ResponseWrapper
.生成的接口包含 webservice 支持的所有方法以及一些注释,例如
@WebMethod
、 @WebResult
、 @RequestWrapper
和@ResponseWrapper
。 I suspect these annotations are required at the client end when making the request, but I am not using this interface.我怀疑在客户端发出请求时需要这些注释,但我没有使用这个接口。
I followed the Springboot tutorial found here but do not see this generated interface class mentioned anywhere.我遵循了此处找到的 Springboot 教程,但在任何地方都没有看到这个生成的接口类。
Below line in Springboot tutorial found here , uses WSDL generated classes (GetQuote and GetQuoteResponse).在此处找到的 Springboot 教程中的以下行使用 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.
Should I be using this interface?我应该使用这个接口吗?
I think yes.我想是的。 In the example, the classes will be generated under
hello.wsdl
package, mentioned under Generate domain objects based on a WSDL
section.在示例中,类将在
hello.wsdl
包下Generate domain objects based on a WSDL
,在Generate domain objects based on a WSDL
部分Generate domain objects based on a WSDL
下提到。 It uses jaxb2 plugin
and you are using wsimport
.它使用
jaxb2 plugin
而您正在使用wsimport
。 Both should work properly.两者都应该正常工作。
Hope this helps you.希望这对你有帮助。
(It will be helpful if you can provide some client and configuration classes similar to your implementation) (如果您可以提供一些类似于您的实现的客户端和配置类,将会很有帮助)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.