gpt4 book ai didi

web-services - 使用 Spring 和 Axis 运行 webservice : unrecognized method

转载 作者:行者123 更新时间:2023-11-28 23:03:51 24 4
gpt4 key购买 nike

我有一个基于 Spring 的 Web 应用程序,我需要使用 Axis 公开一个 Web 服务。我关注了this guide但服务仍然无法正常工作。 要恢复,我有一个像这样的 EndPoint 类:

package service;

import org.springframework.remoting.jaxrpc.ServletEndpointSupport;

public class SpringWSEndPoint extends ServletEndpointSupport implements ISpringWS {
private ISpringWS springWS;

protected void onInit() {
this.springWS = (ISpringWS) getWebApplicationContext().getBean("springWS");
}

public String sayHello(String message) {
return springWS.sayHello(message);
}
}

和 servlet 映射如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>WSSpring</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>axis</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>/axis/*</url-pattern>
</servlet-mapping>
</web-app>

因此,一旦我导航到 http://localhost:8080/myProject/axis/SpringWSEndPoint?wsdl,它就会按预期出现(似乎正确)自动生成的 wsdl。

但是,如果我转到 http://localhost:8080/myProject/axis/SpringWSEndPoint/sayHello,它不会将其识别为服务方法(“No service is available at这个网址”)

我想知道我是否必须以某种方式在任何 .war 或 .aar 文件中手动编译 Web 服务...

谢谢

(我在tomcat中运行)

最佳答案

该服务将接受对 http://localhost:8080/myProject/axis/SpringWSEndPoint 的 POST 请求,但不接受对 http://localhost:8080/myProject/axis 的 GET 请求/SpringWSEndPoint/sayHello. Axis 1.x 不支持这种请求方式。但是,它支持这样的东西(用于测试目的):http://localhost:8080/myProject/axis/SpringWSEndPoint?method=sayHello&message=test

关于web-services - 使用 Spring 和 Axis 运行 webservice : unrecognized method,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13437077/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com