Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No adapter for endpoint in Spring Web Service Response

I just cant figure out this error using Spring Web Services. I believe I did everything correctly.

Soap Error Response

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring xml:lang="en">No adapter for endpoint [public void org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.PersonManagerSyncSoapBindingImpl.readPerson(org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.ReadPersonRequest,org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.Imsx_RequestHeaderInfoType,org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.holders.ReadPersonResponseHolder,org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.holders.Imsx_ResponseHeaderInfoTypeHolder)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
      </SOAP-ENV:Fault>

Annotations

@Endpoint  
public class PersonManagerSyncSoapBindingImpl implements org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.PersonManagerSyncPortType{


    @PayloadRoot(localPart = "readPersonRequest", namespace = "http://www.imsglobal.org/services/lis/pms2p0/wsdl11/sync/imspms_v2p0")
    @ResponsePayload
    public void readPerson(@RequestPayload org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.ReadPersonRequest parameters, org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.Imsx_RequestHeaderInfoType headerInfoParameters, @RequestPayload org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.holders.ReadPersonResponseHolder response, @RequestPayload org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.holders.Imsx_ResponseHeaderInfoTypeHolder headerInfoResponse) {
        response.value = new org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.ReadPersonResponse();
        headerInfoResponse.value = new org.imsglobal.www.services.lis.pms2p0.wsdl11.sync.imspms_v2p0.Imsx_ResponseHeaderInfoType();
    }

spring-ws-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>  
<beans xmlns="http://www.springframework.org/schema/beans"  
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
            xmlns:context="http://www.springframework.org/schema/context"  
            xmlns:sws="http://www.springframework.org/schema/web-services"  
            xsi:schemaLocation="http://www.springframework.org/schema/beans  
                                     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd  
                                     http://www.springframework.org/schema/web-services  
                                     http://www.springframework.org/schema/web-services/web-services-2.0.xsd  
                                     http://www.springframework.org/schema/context  
                                     http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

    <context:component-scan base-package="*"></context:component-scan>
    <sws:annotation-driven/>

    <sws:dynamic-wsdl id="personServiceManagement"                                                           
        portTypeName="PersonManagerSyncPortType"                                                         
        locationUri="/endpoints/"                                                       
        targetNamespace="http://www.imsglobal.org/services/lis/pms2p0/wsdl11/sync/imspms_v2p0">                               
        <sws:xsd location="/WEB-INF/wsdl/xsd/PersonManagementService.xsd"/>                                                  
    </sws:dynamic-wsdl>

</beans>
like image 462
Mike Flynn Avatar asked Mar 07 '13 22:03

Mike Flynn


2 Answers

I had a similar error message. My problem was in request and response class that I generated from XSD. It missed @XMLRootElement annotation. This caused that description of operation (in WSDL) and description of implemented method (in Endpoint) did not match. Adding JAXBElement to my endpoint method solved my problem.

import javax.xml.bind.JAXBElement;

@PayloadRoot(namespace = "http://foo.bar/books", localPart = "GetBook")
@ResponsePayload
public JAXBElement<MyReponse> getBook(@RequestPayload JAXBElement<MyRequest>) {
    ...

See this blog for more details: spring-ws: No adapter for endpoint

like image 142
lu_ko Avatar answered Nov 04 '22 07:11

lu_ko


I think you're missing the return value. Spring-WS uses the method signature to map a request/response combination. For instance, I have the following operation in my generated WSDL:

<wsdl:operation name="GetHiredCandidates">
    <wsdl:input message="tns:GetHiredCandidatesRequest" name="GetHiredCandidatesRequest"></wsdl:input>
    <wsdl:output message="tns:GetHiredCandidatesResponse" name="GetHiredCandidatesResponse"></wsdl:output>
</wsdl:operation>

To map a method on this operation the ResponsePayload and RequestPayload need to match the input and output defined in the WSDL:

@ResponsePayload
public GetHiredCandidatesResponse getKandidaat (@RequestPayload GetHiredCandidatesRequest) {
    ..

    return getHiredCandidatesResponse;
}

Hope this helps!

like image 30
evandongen Avatar answered Nov 04 '22 07:11

evandongen