spring-ws:找不到端点映射 [英] spring-ws: no endpoint mapping found
问题描述
我做了一个简单的Web服务,但是当我尝试在soapui上对其进行测试时,它给出了此错误:
I made a simple web service but when I'am trying to test it on soapui its giving this error:
WARN : [Oct-11 12:56:38,081] ws.server.EndpointNotFound - No endpoint mapping found for [SaajSoapMessage {http://www.servesy.com/api/v1/service}signupRequest]
我不知道该怎么做才能使它正确,我看到了很多与此问题有关的问题,但没有找到任何解决方案.
I do not have any idea what should I do to make it correct, I saw many questions regarding this problem but did not find any solution.
我的spring-ws配置如下:(除此配置外,我还尝试制作简单的输入输出示例,并且也显示相同的警告)
My spring-ws configuration are follows: (apart from this configuration I also tried to make simple input output example and that also shows same warning)
web.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>
servesy-config.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给出了这种类型的空白输出:
and my soupui gives this type of blank output:
推荐答案
当Spring-WS无法找到可以处理传入请求的合适的 @Endpoint
时,发生 EndpointNotFoundException
The EndpointNotFoundException
occurs when Spring-WS cannot find a suitable @Endpoint
that can handle the incoming request.
在这种情况下,传入消息具有名称空间 http://www.servesy.com/api/v1/service
和本地名称 signupRequest
(可以看到)在日志中).虽然您的 @PayloadRoot
映射确实具有相同的名称空间;它没有相同的本地名称,因为它使用带有大写S的 SignupRequest
.如果在 @PayloadRoot
中将大写S更改为小写s,则可能会出现这种情况.注释,它将起作用.
In this case, the incoming message has namespace http://www.servesy.com/api/v1/service
and local name signupRequest
(as can be seen in the log). While your @PayloadRoot
mapping does have the same namespace; it does not have the same local name, as it uses SignupRequest
with a capital S. Chances are that if you change the uppercase S to a lower case s in the @PayloadRoot
annotation, it will work.
这篇关于spring-ws:找不到端点映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!