maria
maria

Reputation: 173

spring-ws: no endpoint mapping found

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

Upvotes: 15

Views: 39954

Answers (5)

They changed it from uppercase to lowercase. Thanks for the information @Arjen Poutsma enter image description here

My image result enter image description here

Upvotes: 0

Jozef
Jozef

Reputation: 1264

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.

Upvotes: 2

razvang
razvang

Reputation: 1285

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

Upvotes: 0

Deepu Surendran
Deepu Surendran

Reputation: 215

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>

Upvotes: 0

Arjen Poutsma
Arjen Poutsma

Reputation: 1256

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.

Upvotes: 24

Related Questions