我做了一个简单的Web服务,但当我试图在soapui上测试它时,它给出了以下错误:
WARN : [Oct-11 12:56:38,081] ws.server.EndpointNotFound - No endpoint mapping found for [SaajSoapMessage {http://www.servesy.com/api/v1/service}signupRequest]
我不知道我应该做些什么来使它正确,我看到了许多关于这个问题的问题,但没有找到任何解决方案。
我的spring-ws配置如下:(除了此配置外,我还尝试制作了简单的输入输出示例,该示例也显示了相同的警告)
网页.xml
<web-app
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/servesy-config.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>servesyservices</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>servesyservices</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>servesyservices</servlet-name>
<url-pattern>/endpoints/*</url-pattern>
</servlet-mapping>
</web-app>
服务配置.xml
<beans
<context:component-scan base-package="com.servesy.webservices" />
<sws:annotation-driven />
<bean id="ServesyService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
<property name="schemaCollection">
<bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="inline" value="true" />
<property name="xsds">
<list>
<value>schemas/ServesyServices.xsd</value>
</list>
</property>
</bean>
</property>
<property name="portTypeName" value="ServesyService"/>
<property name="serviceName" value="ServesyServices" />
<property name="locationUri" value="/endpoints"/>
</bean>
</beans>
端点
@Endpoint
public class ServesyWebServiceEndpoint {
private static final String TARGET_NAMESPACE ="http://www.servesy.com/api/v1/service";
private ServesyWebService servesyservice_i;
@Autowired
public void setServesyWebService(ServesyWebService servesyservice_p)
{
this.servesyservice_i = servesyservice_p;
}
@PayloadRoot(localPart="SignupRequest", namespace=TARGET_NAMESPACE)
public @ResponsePayload SignupResponse response(SignupRequest signupRequest) {
SignupResponse signupResponse = new SignupResponse();
Signup signup = servesyservice_i.signupResponse( signupRequest.getMobileNumber(), signupRequest.getPassword(), signupRequest.getCustomerName(), signupRequest.getEmailId(), signupRequest.getPromoCode(), signupRequest.getDevice());
signupResponse.setSignup(signup);
return signupResponse;
}
@PayloadRoot(localPart="LoginRequest", namespace=TARGET_NAMESPACE)
public @ResponsePayload LoginResponse response(LoginRequest loginRequest) {
LoginResponse loginResponse = new LoginResponse();
String string = servesyservice_i.signinResponse( loginRequest.getEmailID(), loginRequest.getPassword(), loginRequest.getDevice());
loginResponse.setSessionId(string);
return loginResponse;
}
}
我的soupui给出了这种类型的空白输出:
4条答案
按热度按时间qco9c6ql1#
当Spring-WS找不到合适的
@Endpoint
来处理传入的请求时,就会出现EndpointNotFoundException
。在本例中,传入消息具有名称空间
http://www.servesy.com/api/v1/service
和本地名称signupRequest
(如日志中所示)。它没有相同的本地名称,因为它使用带有大写S的SignupRequest
。如果您在@PayloadRoot
注解中将大写S更改为小写s,它可能会工作。insrf1ej2#
上下文级别参数也需要反映在MessageDispatcherServlet级别中
66bbxpm53#
不管怎么说,我在遵循-https://spring.io/guides/gs/producing-web-service/-时遇到了这个问题
2021-02-17 14:13:52.810 DEBUG 204429 --- [nio-8080-exec-7] o.s.w.soap.server.SoapMessageDispatcher : Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping@7f98f516] has no mapping for request
,我不知何故错过了使用@Endpoint public class CountryEndpoint
注解端点j0pj023g4#
我曾经遇到过类似的问题,根本原因是应用程序servlet上下文路径。
在我看来,解决这个问题的最好方法是为**”www.example.com“设置DEBUG**日志级别org.springframework.ws,并仔细查看日志。您应该会看到这样的消息:
并且在发送请求后的警告中说:
因此...它正在键**"/cms-ws/ws/CardInfoWS_v3”下查找端点Map,但端点已在键"/ws/CardInfoWS_v3”下注册。
您也可以将中断点放在端点Map程式(AbstractMapBasedEndpointMapping或AbstractMethodEndpointMapping**)中的方法lookupEndpoint,如下所示:
发送请求后,在调试模式下您将看到所有已注册的端点和当前搜索的键。