我需要帮助将我的 Soap Envelope 映射到 java 类,我的目的是将结果操纵到数据库。
我在获取 SOAP Envelope 或使用 DB 方面没有任何问题,我的问题完全在于 JABX 以及根据我的 SOPA Envoloap 映射我的类。
这是我的肥皂:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<KD4SoapHeaderV2 xmlns="http://www.ibm.com/KD4Soap">A03ODA1YzhlZDQ2MWQAAQ==</KD4SoapHeaderV2>
</soap:Header>
<soap:Body>
<Response xmlns="http://tempuri.org/">
<Result xmlns:a="http://schemas.datacontract.org/2004/07/PS.SharedWebServices.Response" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Errors />
<a:Count>329</a:Count>
<a:Return>SUCCESS</a:Return>
<a:DashboardDTOs>
<a:DashboardDTOs>
<a:Value>28.58</a:Value>
<a:Code>O001</a:Code>
<a:Name>Test2</a:Name>
</a:DashboardDTOs>
<a:DashboardDTOs>
<a:Value>40.22</a:Value>
<a:Code>O002</a:Code>
<a:Name>Test2</a:Name>
</a:DashboardDTOs>
<a:DashboardDTOs>
<a:Value>54.11</a:Value>
<a:Code>O003</a:Code>
<a:Name>Test3</a:Name>
</a:DashboardDTOs>
</a:DashboardDTOs>
</Result>
</Response>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
这是我接收主要值的类(计数、返回和仪表板 DTO 列表):
@XmlRootElement(name = "Response")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Response", propOrder = { "Count", "Return", "DashboardDTOs"})
public class Result {
@XmlElement(name="Count", …Run Code Online (Sandbox Code Playgroud)