spring-ws: no endpoint mapping found
Asked Answered
M

4

14

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

Mutule answered 11/10, 2014 at 8:8 Comment(0)
O
23

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.

Outdated answered 13/10, 2014 at 8:34 Comment(0)
P
2

I have faced a similar issue and the root cause was in the application servlet context path.

The best way how to approach this problem is, in my opinion, to set DEBUG logging level for "org.springframework.ws" and carefully watch logs. You should find a message like this:

o.s.w.s.e.mapping.UriEndpointMapping - Mapped key [/ws/CardInfoWS_v3] onto endpoint [bean 'cardInfoEndpointGateway_v3'; defined in: '...']

And the warn after sending request says:

o.s.w.s.e.mapping.UriEndpointMapping - Looking up endpoint for [/cms-ws/ws/CardInfoWS_v3]
o.s.ws.server.EndpointNotFound - No endpoint mapping found for [SaajSoapMessage {...}GetCardRequest]

So... it is looking for endpoint mapping under the key "/cms-ws/ws/CardInfoWS_v3" but the endpoint is registered under the key "/ws/CardInfoWS_v3".

You can also put the breakpoint to the method lookupEndpoint in your endpoint mapper (AbstractMapBasedEndpointMapping or AbstractMethodEndpointMapping) that looks like this:

protected Object lookupEndpoint(String key) {
    return endpointMap.get(key);
}

and after sending the request, in the debug mode you will see all your registered endpoints and the key which is currently searched.

Phytobiology answered 8/6, 2022 at 13:6 Comment(0)
T
0

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>
Tyronetyrosinase answered 25/11, 2015 at 9:42 Comment(0)
F
0

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

Fauver answered 17/2, 2021 at 13:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.