13

我只是无法使用 Spring Web Services 找出这个错误。我相信我做的一切都是正确的。

肥皂错误响应

<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>

注释

@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>
4

4 回答 4

41

我有一个类似的错误信息。我的问题出在我从 XSD 生成的请求和响应类中。它错过了@XMLRootElement 注释。这导致操作描述(在 WSDL 中)和已实现方法的描述(在 Endpoint 中)不匹配。将 JAXBElement 添加到我的端点方法解决了我的问题。

import javax.xml.bind.JAXBElement;

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

有关更多详细信息,请参阅此博客:spring-ws:端点没有适配器

于 2014-03-06T14:46:01.650 回答
10

我认为您缺少返回值。Spring-WS 使用方法签名来映射请求/响应组合。例如,我在生成的 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>

要在此操作上映射一个方法,ResponsePayload并且RequestPayload需要匹配 WSDL 中定义的输入和输出:

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

    return getHiredCandidatesResponse;
}

希望这可以帮助!

于 2013-03-12T09:30:38.863 回答
1

我对 Spring-ws 和 SOAPUI 有类似的问题,并在No adapter for endpoint SWS的帮助下解决了这个问题

于 2015-01-27T14:58:10.480 回答
0

就我而言,从对 jdom 的依赖切换到 jdom2 后,问题就消失了。

于 2018-04-24T11:07:16.383 回答