spring-ws: no endpoint mapping found

浪尽此生 提交于 2021-02-18 20:48:42

问题


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.

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

@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;
        }
    }

and my soupui gives this type of blank output: enter image description here


回答1:


The EndpointNotFoundException occurs when Spring-WS cannot find a suitable @Endpoint that can handle the incoming request.

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.




回答2:


context level parameters need to be reflected in MessageDispatcherServlet level also.

<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <br>
        <init-param> <br>
            <param-name>transformWsdlLocations</param-name> <br>
            <param-value>true</param-value> <br>
        </init-param> <br>
        <init-param> <br>
            <param-name>contextConfigLocation</param-name> <br>
            <param-value>/WEB-INF/config/servesy-config.xml</param-value> <br>
        </init-param> <br>



回答3:


For what's it worth, I was facing this issue 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 while following - https://spring.io/guides/gs/producing-web-service/- was that I somehow missed to annotate the the endpoint with @Endpoint public class CountryEndpoint



来源:https://stackoverflow.com/questions/26312508/spring-ws-no-endpoint-mapping-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!