Announcement Announcement Module
Collapse
No announcement yet.
WebService config : Endpoint mapping has no mapping for request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebService config : Endpoint mapping has no mapping for request

    Hi there,

    I'm quite tired of this error. Here's my situation:

    System: Win XP SP3, STS 2.1 RC1, SpringFramework 3.0 build 322. Spring-WS 1.5.5. Spring tc Server 6.0

    I want to use maximum annotation for config instead of xml.

    I've :

    application-config.xml
    Code:
    <context:component-scan base-package="com.myapp"/>
    <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/>
    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
      <property name="contextPath" value="com.myapp.ws.types"/>
    </bean>
    web.xml
    Code:
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/myapp-webapp-config.xml</param-value>
    </context-param>
    <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
      <servlet-name>ws</servlet-name>
      <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
      <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/myapp-ws-servlet.xml</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>ws</servlet-name>
      <url-pattern>/ws/*</url-pattern>
    </servlet-mapping>

    myapp-webapp-config.xml
    Code:
    <import resource="classpath:com/myapp/application-config.xml"/>
    
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    ....
    </bean>
    myapp-ws-config.xml
    Code:
    <bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
      <constructor-arg ref="marshaller"/>
    </bean>
    <bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping"/>

    Now the code of my webservice:
    ActionHistoryEndPoint.java
    Code:
    package com.myapp.ws;
    @Endpoint
    public class ActionHistoryEndPoint {
    	private static final String NAMESPACE_URI = "http://localhost:8080/myapp/schemas";	
    
    	@PayloadRoot(namespace=NAMESPACE_URI, localPart="actionHistoryRequest")
    	public ActionHistoryResponse invoke(ActionHistoryRequest request) throws Exception {
    		...
    	}
    And the JAXB class:
    ActionHistoryRequest.java
    Code:
    package com.myapp.ws.types;
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    @XmlRootElement(name = "actionHistoryRequest")
    public class ActionHistoryRequest {
     @XmlAttribute(required = true)
     protected long Action_Id;
      ......
    }
    The webservice client:
    ActionWSClient.java
    Code:
    package com.myapp.ws.client;
    public class ActionWSClient {
      @Autowired
      private WebServiceTemplate webServiceTemplate;
    
      public void webServiceWithJAXB() throws Exception {
        ActionHistoryRequest request = new ActionHistoryRequest();
        request.setAction_Id(10);
        ActionHistoryResponse response = (ActionHistoryResponse) webServiceTemplate.marshalSendAndReceive(request);
        ....
    }
    And finally my webservice client config:
    client-config.xml
    Code:
    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
      <property name="contextPath" value="com.myapp.ws.types"/>
    </bean>
    
    <bean class="org.springframework.ws.client.core.WebServiceTemplate">
      <property name="marshaller" ref="marshaller" />
      <property name="unmarshaller" ref="marshaller" />
      <property name="defaultUri" value="http://localhost:8080/mtug/ws" /> 
    </bean>
    Tomcat logs:
    Code:
    DEBUG: org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter - Accepting incoming [[email protected]b5] to [http://localhost:8080/mtug/ws]
    DEBUG: org.springframework.ws.server.MessageTracing.received - Received request [SaajSoapMessage actionHistoryRequest]
    DEBUG: org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping - Looking up endpoint for [actionHistoryRequest]
    DEBUG: org.springframework.ws.soap.server.SoapMessageDispatcher - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping@16b352c] has no mapping for request
    WARN : org.springframework.ws.server.EndpointNotFound - No endpoint mapping found for [SaajSoapMessage actionHistoryRequest]
    DEBUG: org.springframework.ws.transport.http.MessageDispatcherServlet - Successfully completed request
    "Endpoint mapping [org.springframework.ws.server.endpoint.mapping.Pay loadRootAnnotationMethodEndpointMapping@16b352c] has no mapping for request"

    I've tried thousand of configuration, and it doesn't work. Can anyone help ?

    Is my configuration correct ?? Of course not, but where is the problem?
    Do I have to configure a schema mandatory?
    Is the org.springframework.ws.wsdl.wsdl11.DynamicWsdl11De finition mandatory? (what's the portTypeName by the way ?)

  • #2
    Ok, I fixed it. It seems at least that namespace in my endpoint must be "http://localhost:8080/myapp/ws" to point to webservice servlet dispatcher, and my endpoint must have a constructor without parameters (i think it's required so that spring can instanciate the endpoint bean), otherwise it throws some JDK/CGLIB proxy problem (required cglib librairy anyway to make it work).

    Comment

    Working...
    X