簡體   English   中英

為何SOAP WSDL服務無法識別我的實體?

[英]Why my entity is not recognized by SOAP WSDL service?

我有這種方法:

  @WebResult(name = "accountList")
public List<Account> getAllAccountWithScoreBiggerThan(@WebParam(name = "scoreValue") int scoreValue) {
    System.out.println("bigger than " + scoreValue);
    List<Account> list = dao.findAccountsWithScoreBiggerThan(scoreValue);
    return list;
}

但是,當我使用SoapUI對其進行測試時,我得到以下xml:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <ns2:getAllAccountWithScoreBiggerThanResponse xmlns:ns2="http://service/">
     <accountList/>
     <accountList/>
     <accountList/>
  </ns2:getAllAccountWithScoreBiggerThanResponse>
 </soap:Body>
</soap:Envelope>

當我查看WSDL時,得到了以下內容:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://service/" elementFormDefault="unqualified" targetNamespace="http://service/" version="1.0">
<xs:element name="getAllAccountWithScoreBiggerThan" type="tns:getAllAccountWithScoreBiggerThan"/>
<xs:element name="getAllAccountWithScoreBiggerThanResponse" type="tns:getAllAccountWithScoreBiggerThanResponse"/>
<xs:complexType name="getAllAccountWithScoreBiggerThan">
    <xs:sequence>
        <xs:element name="scoreValue" type="xs:int"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="getAllAccountWithScoreBiggerThanResponse">
    <xs:sequence>
        <xs:element maxOccurs="unbounded" minOccurs="0" name="accountList" type="tns:account"/>
    </xs:sequence>
</xs:complexType>
<xs:complexType name="account">
    <xs:sequence/>
</xs:complexType>

這不是應該列出我所有的帳戶屬性嗎? 如何更改輸出以列出實體屬性? 調試時,我通常可以看到所有屬性。

我不知道為什么,也沒有找到源,但是屬性需要同時命名為getter和setter才能使用SOAP。 我添加它們后,它運行良好

暫無
暫無

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

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