Announcement Announcement Module
Collapse
No announcement yet.
No adapter for endpoint [ ... ] Does your endpoint implement a supported interface... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No adapter for endpoint [ ... ] Does your endpoint implement a supported interface...

    This is driving me mad... I Created a project using JaxB the problem is it throws this exception...

    No adapter for endpoint [public com.cda.gsp.dto.GetClientesResponse com.cda.gsp.webServices.GspServiceEndpoint.obtener Clientes()]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?...

    Here is the spring-ws-servlet.xml

    ...

    <!-- ===================== ENDPOINTS ===================================== -->

    <bean id="GspServiceEndpoint" class="com.cda.gsp.webServices.GspServiceEndpoint" >
    <property name="mapper" ref="net.sf.dozer.util.mapping.MapperIF"></property>
    <property name="service" ref="gspService"></property>
    </bean>

    <!-- ===================== ENDPOINT MAPPINGS ============================== -->

    <bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping">
    <property name="interceptors">
    <list>
    <bean class="org.springframework.ws.server.endpoint.inte rceptor.PayloadLoggingInterceptor"/>
    <bean class="org.springframework.ws.soap.server.endpoint .interceptor.PayloadValidatingInterceptor">
    <property name="schema" value="/WEB-INF/GSPXMLSchema.xsd"/>
    <property name="validateRequest" value="true"/>
    <property name="validateResponse" value="true"/>
    </bean>
    </list>
    </property>
    </bean>

    <!-- ===================== ENDPOINT ADAPTERS ============================== -->
    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="contextPath" value="com.cda.gsp.dto"/>
    </bean>

    <bean class="org.springframework.ws.server.endpoint.adap ter.GenericMarshallingMethodEndpointAdapter">
    <constructor-arg ref="marshaller"/>
    </bean>

    <!-- ===================== WSDL DEFINITION ============================== -->

    <bean id="GSPWS" class="org.springframework.ws.wsdl.wsdl11.DynamicW sdl11Definition">
    <property name="builder">
    <bean class="org.springframework.ws.wsdl.wsdl11.builder. XsdBasedSoap11Wsdl4jDefinitionBuilder">
    <property name="schema" value="/WEB-INF/GSPXMLSchema.xsd"/>
    <property name="portTypeName" value="GSPPort"/>
    <property name="locationUri" value="http://localhost:8080/GSP/services/"/>
    <property name="targetNamespace" value="http://www.example.org/GSPXMLSchema/definitions"/>
    </bean>
    </property>
    </bean>

    ...


    *this is the XSD...


    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.example.org/GSPXMLSchema"
    targetNamespace="http://www.example.org/GSPXMLSchema"
    elementFormDefault="qualified">

    <element name="GetProyectoRequest" type="int"></element>

    <element name="GetProyectoResponse">
    <complexType>
    <sequence maxOccurs="unbounded" minOccurs="1">
    <element name="Proyecto" type="tns:Proyecto"></element>
    </sequence>
    </complexType>
    </element>

    <complexType name="Proyecto">
    <sequence>
    <element name="idProyecto" type="int"></element>
    <element name="nombre" type="string"></element>
    <element name="descripcion" type="string"></element>
    <element name="liderDeProyecto" type="tns:liderDeProyectoType" nillable="true"></element>
    <element name="cliente" type="tns:clienteType" nillable="true"></element>
    </sequence>
    </complexType>

    <complexType name="liderDeProyectoType">
    <sequence>
    <element name="nombre" type="string"></element>
    <element name="apellido" type="string"></element>
    <element name="perfil" type="string"></element>
    </sequence>
    </complexType>

    <complexType name="clienteType">
    <sequence>
    <element name="idCliente" type="int"></element>
    <element name="descripcion" type="string"></element>
    </sequence>
    </complexType>

    <complexType name="Cliente">
    <sequence>
    <element name="idCliente" type="int"></element>
    <element name="razonSocial" type="string"></element>
    <element name="clienteDesde" type="date"></element>
    </sequence>
    </complexType>

    <element name="GetClientesRequest">
    <complexType />
    </element>
    <element name="GetClientesResponse">
    <complexType>
    <sequence maxOccurs="unbounded" minOccurs="0">
    <element name="Cliente" type="tns:Cliente"></element>
    </sequence>
    </complexType>
    </element>

    </schema>


    *this is a class generated by the jaxb eclipse plugin which i have problems with...


    package com.cda.gsp.dto;

    import java.util.ArrayList;
    import java.util.List;
    import javax.xml.bind.annotation.XmlAccessType;
    import javax.xml.bind.annotation.XmlAccessorType;
    import javax.xml.bind.annotation.XmlElement;
    import javax.xml.bind.annotation.XmlRootElement;
    import javax.xml.bind.annotation.XmlType;


    /**
    * <p>Java class for GetClientesResponse element declaration.
    *
    * <p>The following schema fragment specifies the expected content contained within this class.
    *
    * <pre>
    * &lt;element name="GetClientesResponse">
    * &lt;complexType>
    * &lt;complexContent>
    * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    * &lt;sequence maxOccurs="unbounded" minOccurs="0">
    * &lt;element name="Cliente" type="{http://www.example.org/GSPXMLSchema}Cliente"/>
    * &lt;/sequence>
    * &lt;/restriction>
    * &lt;/complexContent>
    * &lt;/complexType>
    * &lt;/element>
    * </pre>
    *
    *
    */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
    "cliente"
    })
    @XmlRootElement(name = "GetClientesResponse")
    public class GetClientesResponse {

    @XmlElement(name = "Cliente", namespace = "http://www.example.org/GSPXMLSchema", required = true)
    protected List<Cliente> cliente;

    /**
    * Gets the value of the cliente property.
    *
    * <p>
    * This accessor method returns a reference to the live list,
    * not a snapshot. Therefore any modification you make to the
    * returned list will be present inside the JAXB object.
    * This is why there is not a <CODE>set</CODE> method for the cliente property.
    *
    * <p>
    * For example, to add a new item, do as follows:
    * <pre>
    * getCliente().add(newItem);
    * </pre>
    *
    *
    * <p>
    * Objects of the following type(s) are allowed in the list
    * {@link Cliente }
    *
    *
    */
    public List<Cliente> getCliente() {
    if (cliente == null) {
    cliente = new ArrayList<Cliente>();
    }
    return this.cliente;
    }

    }


    *and last... the endpoint

    package com.cda.gsp.webServices;

    import java.util.Collection;

    import javax.xml.bind.JAXBElement;

    import net.sf.dozer.util.mapping.MapperIF;

    import org.springframework.ws.server.endpoint.annotation. Endpoint;
    import org.springframework.ws.server.endpoint.annotation. PayloadRoot;

    import com.cda.gsp.dto.GetClientesResponse;
    import com.cda.gsp.dto.GetProyectoResponse;
    import com.cda.gsp.model.Cliente;
    import com.cda.gsp.model.Proyecto;
    import com.cda.gsp.services.GspService;

    @Endpoint
    public class GspServiceEndpoint {

    private MapperIF mapper;
    public GspService service;


    @PayloadRoot(localPart = "GetProyectoRequest", namespace = "http://www.example.org/GSPXMLSchema")
    public GetProyectoResponse obtenerProyectoPorId(JAXBElement<Integer> idProyecto) {
    Proyecto aProyecto = this.service.obtenerProyectoPorId(idProyecto.getVa lue());
    return (GetProyectoResponse) mapper.map(aProyecto, GetProyectoResponse.class);
    }

    @PayloadRoot(localPart = "GetClientesRequest", namespace = "http://www.example.org/GSPXMLSchema")
    public GetClientesResponse obtenerClientes() {
    Collection<Cliente> clientes = this.service.obtenerClientes();
    return (GetClientesResponse) mapper.map(clientes, GetClientesResponse.class);
    }

    public MapperIF getMapper() {
    return mapper;
    }

    public void setMapper(MapperIF mapper) {
    this.mapper = mapper;
    }

    public GspService getService() {
    return service;
    }

    public void setService(GspService service) {
    this.service = service;
    }

    }

    now where is the problem... public GetProyectoResponse obtenerProyectoPorId(JAXBElement<Integer> idProyecto) is working fine and I dont have to declare a JAXBElement for GetProyectoResponse... but when I try to access public GetClientesResponse obtenerClientes() it throws the no adapter exception... can somebody help me...

  • #2
    This is more a JAXB2 issue than a Spring-WS issue, but let's see if I can help you.

    The classes generated by JAXB2 from your schema come in two flavors: those that have a @XmlRootElement annotation, which can be used directly as either parameter or response, and those who haven't. Those classes which haven't got this annotation need to be wrapped in a JAXBElement.

    Besides the generated classes from your schema, JAXB2 also generates an ObjectFactory class, which clarifies the use of JAXBElement. There are some factory methods is there, which illustrate how you can use the various schema types.

    Comment


    • #3
      I have found the problem the JAXB endpoint must have a JAXB element as a parameter event if it has no atributtes ( its generated by the plugin from the XSD).
      this is the final endpoint

      @PayloadRoot(localPart = "GetClientesRequest", namespace = "http://www.example.org/GSPXMLSchema")
      public GetClientesResponse obtenerClientes(GetClientesRequest request) {
      Collection<Cliente> clientes = this.service.obtenerClientes();
      GetClientesResponse clientesResponse = new GetClientesResponse();
      for (Cliente cliente : clientes) {
      clientesResponse.getCliente().add((com.cda.gsp.dto .Cliente) mapper.map(cliente, com.cda.gsp.dto.Cliente.class));
      }

      return clientesResponse;
      }

      thank you for your time

      Comment


      • #4
        Does your endpoint implement a supported interface like MessageHandler or PayloadEndp

        Arjen,

        I am having the same problem, but I don't understand your explanation.
        I am using JAXB2. The generated class from my xsd is wrapped in @XmlRootElement( (unfortunately on preview of this I keep getting
        an error about posting urls to another site, so hand edited the urls out an put in
        "url").

        Basically, I took the Spring In Action Poker-WS and converted it to my needs. The
        real difference is that I am using JAXB2 for the marshalling.

        Also, is there any way to see the dynamically generated wsdl?

        Thanks for your help this is driving me crazy,
        manco

        This is the error I am getting, followed by my xxx-servlet.xml file contents

        [DEBUG] 14:43:10 SoapMessageDispatcher - MessageDispatcher with name 'musiclocker' received request [SaajSoapMessage {url/musiclocker/schemas}LoginUserRequest]
        [DEBUG] 14:43:10 PayloadRootAnnotationMethodEndpointMapping - Looking up endpoint for [{url}LoginUserRequest]
        [DEBUG] 14:43:10 SoapMessageDispatcher - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.Pay loadRootAnnotationMethodEndpointMapping@578b06] has no mapping for request
        [DEBUG] 14:43:10 PayloadRootQNameEndpointMapping - Looking up endpoint for [{url}LoginUserRequest]
        [DEBUG] 14:43:10 SoapMessageDispatcher - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.Pay loadRootQNameEndpointMapping@16856e3] maps request to endpoint [com.timr.music.webservice.LoginUserMarshallingEndp oint@1ec265c]
        [DEBUG] 14:43:10 SoapMessageDispatcher - Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.Mar shallingMethodEndpointAdapter@9e2e50]
        [DEBUG] 14:43:10 SoapMessageDispatcher - Testing endpoint exception resolver [org.springframework.ws.soap.server.endpoint.SoapFa ultMappingExceptionResolver@f2a026]
        [ WARN] 14:43:10 SoapMessageDispatcher - Endpoint invocation resulted in exception - responding with SOAP Fault
        java.lang.IllegalStateException: No adapter for endpoint [com.timr.music.webservice.LoginUserMarshallingEndp oint@1ec265c]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?
        at org.springframework.ws.server.MessageDispatcher.ge tEndpointAdapter(MessageDispatcher.java:269)
        at org.springframework.ws.server.MessageDispatcher.di spatch(MessageDispatcher.java:210)
        at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:158)
        at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:87)
        at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:57)
        at org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:158)
        at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:475)
        at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:440)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:710)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
        at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:286)
        at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)


        This is my -servlet.xml file:
        <?xml version="1.0" encoding="UTF-8"?>

        <beans xmlns="url"
        xmlns:xsi="url"
        xsi:schemaLocation="url
        spring-beans.xsd">

        <!--
        An XML payload-to-endpoint mapping.

        From Section 9.4.2, page 363.
        -->
        <bean id="payloadMapping"
        class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootQNameEndpointMapping">
        <property name="endpointMap">
        <map>
        <entry key="{url}LoginUserRequest"
        value-ref="loginUserEndpoint" />
        </map>
        </property>
        <property name="order" value="2" />
        </bean>

        <!--
        An XML payload-to-endpoint mapping that uses the @PayloadRoot annotation on methods
        in beans annotated with @Endpoint. This endpoint mapping is new to Spring-WS as of
        version 1.0.0 and thus is not discussed in the book.
        -->
        <bean class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping">
        <property name="order" value="1"/>
        </bean>

        <!--
        An endpoint adapter to handle the marshaling of the in/out of the annotated endpoint.
        Only needed for the annotated endpoint.
        -->
        <bean class="org.springframework.ws.server.endpoint.adap ter.MarshallingMethodEndpointAdapter">
        <constructor-arg ref="marshaller"/>
        </bean>

        <!--
        A marshaling Login User handler endpoint.

        From section 9.4.3, page 364.
        -->

        <bean id="loginUserEndpoint"
        class="com.timr.music.webservice.LoginUserMarshall ingEndpoint">
        <property name="marshaller" ref="marshaller" />
        <property name="unmarshaller" ref="marshaller" />
        <property name="loginUserHandler" ref="loginUserHandler" />
        </bean>

        <!--
        JAXB 2 Based Marsahlling
        -->

        <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
        <description>
        The JAXB 2 Marshaller is used by the endpoints.
        </description>
        <property name="contextPath" value="com.timr.xsd"/>
        </bean>

        <!--
        SoapFaultMappingExceptionResolver to map exceptions thrown from an
        endpoint to SOAP faults.

        From section 9.4.5, page 368.
        -->
        <bean id="endpointExceptionResolver"
        class="org.springframework.ws.soap.server.endpoint .SoapFaultMappingExceptionResolver">
        <property name="defaultFault"
        value="RECEIVER,Server error" />
        <property name="exceptionMappings">
        <props>
        <prop key="org.springframework.oxm.UnmarshallingExceptio n">
        SENDER,Invalid request</prop>
        <prop key="org.springframework.oxm.ValidationFailureExce ption">
        SENDER,Invalid request</prop>
        </props>
        </property>
        </bean>

        <!--
        SimpleWsdl11Definition to load a pre-defined WSDL. Assuming that
        MessageDispatcherServlet's transformWsdlLocations init-param is set
        to true, any location URLs in the pre-defined WSDL will be
        transformed to match the location where the MessageDispatcherServlet
        is deployed.

        From section 9.4.6, page 372.
        -->
        <!--
        <bean id="poker"
        class="org.springframework.ws.wsdl.wsdl11.SimpleWs dl11Definition">
        <property name="wsdl" value="/PokerService.wsdl"/>
        </bean>
        -->

        <!--
        DynamicWsdl11Definition to automagically generate WSDL from the messages'
        XSD.

        From section 9.4.6, page 369.

        see API for XsdBasedSoap11Wsdl4jDefinitionBuilder
        HowTo handle multiple schemas:
        "...
        By default, the schema file is inlined in a types block. However,
        if the schemaLocation property is set, an XSD import is used instead.
        As such, the imported schema file can contain further imports, which
        will be resolved correctly in accordance with the schema location.
        ..."
        -->
        <bean id="music"
        class="org.springframework.ws.wsdl.wsdl11.DynamicW sdl11Definition">
        <property name="builder">
        <bean class="org.springframework.ws.wsdl.wsdl11.builder. XsdBasedSoap11Wsdl4jDefinitionBuilder">
        <property name="schema" value="/WEB-INF/schemas/com/timr/xsd/MusicTypes.xsd"/>
        <property name="portTypeName" value="MusicLocker"/>
        <property name="locationUri" value="url localhost:8080/Music-WS/services"/>
        </bean>
        </property>
        </bean>
        </beans>

        Comment

        Working...
        X