为什么我的实体不被 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 一起使用。添加后,效果很好
我有这个方法:
@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 一起使用。添加后,效果很好