遇到错误“找不到 SaajSoapMessage 的端点映射"; [英] Stuck with error "No endpoint mapping found for SaajSoapMessage"

查看:40
本文介绍了遇到错误“找不到 SaajSoapMessage 的端点映射";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始使用 Spring Boot 并创建一个 SOAP Web 服务.

I'm taking my first steps with Spring Boot and creating a SOAP web service.

遵循生成 SOAP 网络服务(https://spring.io/guides/gs/production-web-service/) 教程,我设法创建了一个简单的网络服务.

Following the Producing a SOAP web service (https://spring.io/guides/gs/producing-web-service/) tutorial, I managed to create a simple web service that worked.

扩展该示例,现在我正在尝试创建具有多个操作的 Web 服务.这次我使用了 wsdl 来生成所有的 JAXB 类.一切都正确生成,我可以调用 Web 服务并获得 wsdl 结果.

Expanding on that example, now I'm trying to create a web service with more than one operation. This time I used a wsdl to generate all the JAXB classes. Everything is generated correctly and I can call the web service and get the wsdl as a result.

然后我使用 SOAP UI 根据返回的 wsdl 为我的方法生成示例请求,但是当我尝试执行它们时,我收到错误(实际上是警告):

I then used SOAP UI to generate sample requests for my methods based on the returned wsdl, but when I try to execute them I get the error (actually warning):

WARN 10280 --- [nio-8080-exec-1] o.s.ws.server.EndpointNotFound:没有找到 [SaajSoapMessage Ping] 的端点映射

WARN 10280 --- [nio-8080-exec-1] o.s.ws.server.EndpointNotFound : No endpoint mapping found for [SaajSoapMessage Ping]

过去两天我一直被困在这个问题上.考虑到问题可能是我的端点方法的参数不匹配,我尝试创建一个接收单个字符串的操作 (Ping),但即使是那个也失败了.

And I've been stuck in this for the last two days. Thinking that the problem could be a mismatch in the parameters of my endpoint method, I tried creating an operationg (Ping) that receives a single string, but even that one fails.

我正在使用一个配置器类,我能找到的所有示例都使用配置文件(web.xml 和 servlet 文件),我无法将这些部分放在一起来解决这个问题.

I'm using a configurator class and all the examples I could find use configuration files (web.xml and the servlet file), and I can't put the pieces together to fix this.

这是我的配置类(我删除了导入以节省空间):

This is my configuration class (I've removed the imports to save space):

package ws;

@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setApplicationContext(applicationContext);
    servlet.setTransformWsdlLocations(true);
    return new ServletRegistrationBean(servlet, "/SVN/*");
}


@Bean (name = "SVNClient")
  public Wsdl11Definition defaultWsdl11Definition() {
    SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
    wsdl11Definition.setWsdl(new ClassPathResource("/wsdl/SVNClient.wsdl"));

    return wsdl11Definition;
  }
}

这是我拥有端点的类(我删除了导入以节省空间):

And this is the class where I have my Endpoints (I've removed the imports to save space):

package ws;

@Endpoint
public class WebServiceEndPoint {
private static final String NAMESPACE_URI = "http://gestion.svn.client";

@Autowired
public WebServiceEndPoint() {
    System.out.println("Entramos en WebServiceEndPoint");
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "Ping")
public @ResponsePayload PingResponse ping() {
    PingResponse resposta = new PingResponse();
    resposta.setOut("I'm in");
    return resposta;
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getLog")
public @ResponsePayload GetLogResponse getLog(@RequestPayload InputParameters wsPayload) {
    GetLogResponse response = new GetLogResponse();

    response.setCODERROR("0");
    response.setMENSAJEERROR("I'm in");

    return response;
}

我的疑问是:

@Endpoint@PayloadRoot 注释是否足以将端点映射到 Web 服务操作?我的意思是:

Are the @Endpoint and @PayloadRoot annotations enough to map the endpoints to the web service operations? I mean:

  • 方法或参数声明中是否存在某些内容使它们与 Web 服务定义不匹配?
  • 或者我是否仍然需要一些配置文件(web.xml、servlet 或其他文件)来执行此映射?

推荐答案

重建 wsdl 后,它开始工作.我猜有什么地方不对,它与我的端点定义不匹配.

After rebuilding the wsdl it started working. I guess something was not right and it didn't match my endpoint definition.

这篇关于遇到错误“找不到 SaajSoapMessage 的端点映射";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆