gpt4 book ai didi

spring-ws:未找到端点映射

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

我做了一个简单的网络服务,但是当我试图在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配置如下:
(除了这个配置,我还尝试制作简单的输入输出示例,并且
也显示相同的警告)

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>

服务-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 给出了这种类型的空白输出:
enter image description here

最佳答案

EndpointNotFoundException当 Spring-WS 找不到合适的 @Endpoint 时发生可以处理传入的请求。

在这种情况下,传入消息具有命名空间 http://www.servesy.com/api/v1/service和本地名称 signupRequest (如在日志中所见)。而您的 @PayloadRoot映射确实具有相同的命名空间;它没有相同的本地名称,因为它使用 SignupRequest用大写的 S。如果您在 @PayloadRoot 中将大写的 S 更改为小写的 s,则很有可能注释,它会起作用。

关于spring-ws:未找到端点映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26312508/

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