spring-ws No adapter for endpoint ***: Is your endpoint annotated with @Endpoint?

來源:互聯網
上載者:User

在使用spring ws 開發webservice 時,遇到如下錯誤:

No adapter for endpoint [public com.ibm.eve.schemas.RequestChargeResponse com.ibm.eve.ws.RequestChargeEndpoint.requestCharge(long)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?

網上搜到一個解決方案:http://stackoverflow.com/questions/4975721/jaxb-spring-ws-no-adapter-for-endpoint-while-using-jaxbelement

但是試了一下,不是這個問題。

我寫的xsd沒有問題,

找了半天,原來請求介面寫錯了,如果你的請求的方法中參數是一個對象:

<xs:element name="RequestChargeRequest">
          <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" name="Vin" type="xs:string"/>
                <xs:element minOccurs="0" name="Soc" type="xs:double"/>
                <xs:element minOccurs="0" name="ConnVoltage" type="xs:int"/>
                <xs:element name="TimeRange" type="eve:TimeRange"/>
                <xs:element name="GeoLocation" type="eve:GeoLocation"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

那在你的Endpoint對應的方法上一定也要是這個對象:

@PayloadRoot(localPart = "RequestChargeRequest", namespace = "http://ibm.com/eve/schemas")
    @Namespace(prefix = "sch", uri="http://ibm.com/eve/schemas")
    public RequestChargeResponse requestCharge(RequestChargeRequest request) {

我開始寫成裡面的5個參數了,才報了上面的錯誤。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.