簡體   English   中英

Spring Web Service Response中沒有端點適配器

[英]No adapter for endpoint in Spring Web Service Response

我只是無法使用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();
    }

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

我有一個類似的錯誤消息。 我的問題出在我從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:沒有端點適配器

我想你錯過了回報價值。 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>

要在此操作上映射方法, ResponsePayloadRequestPayload需要匹配WSDL中定義的輸入和輸出:

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

    return getHiredCandidatesResponse;
}

希望這可以幫助!

我在使用Spring-ws和SOAPUI時遇到了類似的問題,並且在沒有適配器端點SWS的幫助下解決了它

在我的情況下,問題已經從jdom的依賴轉換到jdom2。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM