gpt4 book ai didi

web-services - 设置 Spring Web Service 时找不到端点映射

转载 作者:行者123 更新时间:2023-12-04 04:49:42 25 4
gpt4 key购买 nike

我是设置 spring web 应用程序的初学者。我已经走到这一步了,但现在我发现自己被困住了。

我收到以下错误:

WARNING: No endpoint mapping found for [SaajSoapMessage {http://mycompany.com/weather/schemas}GetCities]

主要问题是我已经想不出去哪里寻找调试信息了。我修复了尽可能多的错误,但现在我什至无法在日志中找到任何错误。所以我有点绝望了。

这是我的 web.xml

<web-app>
<display-name>Weather report webservice</display-name>

<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-ws-servlet.xml</param-value>
</init-param>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>spring-ws</servlet-name>
<url-pattern>/weatherws</url-pattern>
</servlet-mapping>
</web-app>

这是我的spring-ws-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="path.to.weather"/>

<sws:annotation-driven/>

</beans>

这是我的端点的样子:

@Endpoint
public class WeatherEndpoint {

private static final String NAMESPACE_URI = "http://mycompany.com/weather/schema";

private WeatherReportManager manager;

@Autowired
public WeatherEndpoint(WeatherReportManager manager) throws JDOMException {
this.manager = manager;
}

@PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetCities")
@ResponsePayload
public Element getCities() {
Element toReturn = null;

for(City city : manager.getCities()) {
//To some stuff
}

return toReturn;
}
}

这是我现在看到的 catalina.log。我试图通过编辑 logging.properties 让 Tomcat 输出 DEBUG 消息。这并没有产生任何额外的效果。

INFO: Deploying web application archive weather.war
Feb 15, 2012 3:28:51 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring-ws': initialization started
Feb 15, 2012 3:28:51 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'spring-ws-servlet': startup date [Wed Feb 15 15:28:51 EET 2012]; root of context hierarchy
Feb 15, 2012 3:28:52 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-ws-servlet.xml]
Feb 15, 2012 3:28:52 PM org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping afterPropertiesSet
INFO: Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
Feb 15, 2012 3:28:52 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@36496381: defining beans [weatherEndpoint,weatherReportManagerWWW,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.dom.JDomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Feb 15, 2012 3:28:52 PM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet
INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
Feb 15, 2012 3:28:52 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring-ws': initialization completed in 714 ms
Feb 15, 2012 3:28:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Feb 15, 2012 3:28:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory lib
Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Feb 15, 2012 3:28:53 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 15, 2012 3:28:53 PM org.apache.coyote.ajp.AjpProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8777 ms
Feb 15, 2012 3:29:07 PM org.springframework.ws.server.MessageDispatcher dispatch
WARNING: No endpoint mapping found for [SaajSoapMessage {http://mycompany.com/weather/schemas}GetCities]

如有任何帮助,我将不胜感激。如果您需要查看任何其他信息,请告诉我。

最佳答案

在您的端点代码中:

private static final String NAMESPACE_URI = "http://mycompany.com/weather/schema";

但您的消息来自 http://mycompany.com/weather/schemas 命名空间。注意最后的 s

关于web-services - 设置 Spring Web Service 时找不到端点映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9294774/

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