I need help to mapping my Soap Envelope to java Classes, my intention manipulate the results to DB.
I dont't have problems with get my SOAP Envelope or to work With DB, my problems is totaly with JABX and mapping my classes according my SOPA Envoloap.
This is my SOAP:
<?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>
This is my the Class with receive the main values (count, return and list of Dashboards DTO):
@XmlRootElement(name = "Response")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Response", propOrder = { "Count", "Return", "DashboardDTOs"})
public class Result {
@XmlElement(name="Count", required = true)
private Integer Count;
@XmlElement(name="Return", required = true)
private String Return;
@XmlElement(name = "DashboardDTOs")
private List<DashboardDTOs> DashboardDTOs;
...
This is the second model that receives the DashboardDTO:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DashboardDTOs", propOrder = {
"Value",
"Code",
"Name"
})
public class DashboardDTOs {
@XmlElement(name = "Value")
private double Value;
@XmlElement(name = "Code")
private String Code;
@XmlElement(name = "Name")
private String Name;
...
And my app try to convert the SOAPEnvelope to a Result but I got error:
Unmarshaller unmarshaller = JAXBContext.newInstance(Result.class).createUnmarshaller();
GetListSummarizedTransactionResultDTO returnValue = (Result)unmarshaller.unmarshal(soapMessagem.getSOAPBody().extractContentAsDocument());
unexpected element (uri:"http://tempuri.org/", local:"Response"). Expected elements are <{}Result>
what I'm doing wrong?
Thans