Announcement Announcement Module
Collapse
No announcement yet.
Spring ws not finding the adaptor when using annotated endpoints Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring ws not finding the adaptor when using annotated endpoints

    I am using Java 6 and spring-ws to create a very simple web service which receives 2 parameters in the form of a BusquedaRequest Jaxb object and returns the same object.

    The object has been created with xjc compiler and I am using Jaxb2Marshaller as the mashaller and GenericMarshallingMethodEndpointAdapter to convert to incoming xml and out going. I had this working when extending the AbstractMarshallingPayloadEndpoint class but when I switch to using the Endpoint and payload annotations it always fails.

    The web service starts up fine but when hitting it with a client I recieve this exception.

    Code:
    java.lang.IllegalStateException: No adapter for endpoint [public package.busqueda.ws.BusquedaRequest package.busqueda.ws.BusquedaEndpoint.getResultas(package.busqueda.ws.BusquedaRequest)]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?
     at org.springframework.ws.server.MessageDispatcher.getEndpointAdapter(MessageDispatcher.java:286)
     at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:227)
     at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:170)
     at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
     at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
     at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
     at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
     at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
     at java.lang.Thread.run(Thread.java:662)
    I have seen response to this question which suggest to compile objects using the xjc compiler which I have done. Also there has been suggestions that the Adaptor hasn't been defined in the spring-ws-servlet.xml, which I have also done. See the spring-ws-servlet.xml defined below:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
     <bean id="busquedaEndpoint" class="package.BusquedaEndpoint" />
    
     <bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
            <constructor-arg ref="marshaller"/>
        </bean>
    
        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="classesToBeBound">
                <list>
                    <value>package.BusquedaRequest</value>
                </list>
            </property>
        </bean>
    
     <bean id="busqueda"
      class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
      <property name="schema" ref="schema" />
      <property name="portTypeName" value="Busqueda" />
      <property name="locationUri" value="/BusquedaService/" />
     </bean>
    
     <bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
      <property name="xsd" value="/WEB-INF/busqueda.xsd" />
     </bean>
    
     <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping"/>
    </beans>
    The class endpoint is as follows:

    p
    Code:
    ackage package.busqueda.ws;
    
    import org.springframework.ws.server.endpoint.annotation.Endpoint;
    import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
    
        @Endpoint
    public class BusquedaEndpoint {
    
     @PayloadRoot(localPart = "BusquedaRequest", namespace = "http://busqueda/schemas")
     public BusquedaRequest getResultas( BusquedaRequest aRequest ) {
      return aRequest;
     }
    
    }
    The xsd I generated the BusqeudaRequest object is as follows:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     elementFormDefault="qualified"
     attributeFormDefault="qualified" 
     xmlns="http://busqueda/schemas"
     targetNamespace="http://busqueda/schemas">
     <xs:element name="BusquedaRequest">
      <xs:complexType>
       <xs:all>
        <xs:element name="Consulta" type="xs:string" />
        <xs:element name="Permisos" type="xs:string" />
       </xs:all>
      </xs:complexType>
     </xs:element>
    </xs:schema>
    Anyone got any thoughts which extend the suggestions I have already implemented?
    Last edited by whatsthebeef; Dec 22nd, 2010, 12:41 PM. Reason: typo

  • #2
    Are you able to see your busqueda.wsdl ?
    spring-ws always expects the request and respone to have the suffix "request" and "response" respectively. In your case both request and response are same..

    Comment


    • #3
      Look at this thread: http://forum.springsource.org/showthread.php?t=100170

      It might be related

      Comment

      Working...
      X