您好我已经尝试了很多但是我无法找到标记别名出错的地方,我的Xml响应是这样的:
<ns1:redcustomerviewResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://tempuri.org/weblink">
<jobcard xsi:type="ns3:Array" ns3:arrayType="ns2:RedCustViewDAO[1]" xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/">
<additionalrepair xsi:type="xsd:string">N/A</additionalrepair>
<custcomplaint xsi:type="xsd:string">SERVICE</custcomplaint>
<custname xsi:type="xsd:string">BABAN DEOKAR</custname>
<expdeliverydate xsi:type="xsd:string">17/07/2014</expdeliverydate>
<hours xsi:type="xsd:string">600</hours>
<jobCardNo xsi:type="xsd:string">sd</jobCardNo>
<jobcarddate xsi:type="xsd:string">17/07/2014</jobcarddate>
<jobcloseddate xsi:type="xsd:string">18/07/2014</jobcloseddate>
<jobsource xsi:type="xsd:string">Normal-Workshop</jobsource>
<labourdetails xsi:type="xsd:string">FREE SERVICE</labourdetails>
<phoneno xsi:type="xsd:string">8270325053</phoneno>
<serivceadvname xsi:type="xsd:string">SANDEEP</serivceadvname>
<servDealerCode xsi:type="xsd:string">ABD35926</servDealerCode>
<servicehstry xsi:type="xsd:string">ServiceHistory</servicehstry>
<servicesubtype xsi:type="xsd:string">Second</servicesubtype>
<servicetype xsi:type="xsd:string">Scheduled Services</servicetype>
<technicianname xsi:type="xsd:string">IRFAN SHAIKH</technicianname>
<tractorSrNo xsi:type="xsd:string">sd685</tractorSrNo>
</jobcard>
</ns1:redcustomerviewResponse>
Aliasing Class就是这个
@XStreamAlias("ns1:redcustomerviewResponse")
public class JobCardResponse {
@XStreamAlias("jobcard")
private Return _return;
public Return getReturn() {
return _return;
}
public void setReturn(Return _return) {
this._return = _return;
}
@Override
public String toString() {
return "AuthenticationResponse [strResponsecdc=" + getReturn().toString() + "]";
}
@XStreamAlias("jobcard")
public static class Return {
@XStreamAlias("additionalrepair")
private static String additionalRepair;
@XStreamAlias("custcomplaint")
private static String CustComplaint;
@XStreamAlias("custname")
private static String customerName;
@XStreamAlias("expdeliverydate")
private static String expDeliveryDate;
@XStreamAlias("hours")
private static String hours;
@XStreamAlias("jobCardNo")
private static String jobCardNo;
@XStreamAlias("jobcarddate")
private static String jobcarddate;
@XStreamAlias("jobsource")
private static String jobSource;
@XStreamAlias("jobcloseddate")
private static String jobCloseDate;
@XStreamAlias("labourdetails")
private static String labourDetails;
@XStreamAlias("phoneno")
private static String phoneNo;
@XStreamAlias("serivceadvname")
private static String serivceAdvName;
@XStreamAlias("servDealerCode")
private static String servDealerCode;
@XStreamAlias("servicehstry")
private static String serviceHistry;
@XStreamAlias("servicesubtype")
private static String serviceSubType;
@XStreamAlias("servicetype")
private static String serviceType;
@XStreamAlias("technicianname")
private static String technicianName;
@XStreamAlias("tractorSrNo")
private static String tractorSrNo;
public String getCustomerComplaint() {
return CustComplaint;
}
public void setCustomerComplaint(String customerComplaint) {
this.CustComplaint = customerComplaint;
}
public String getAdditionalRepair() {
return additionalRepair;
}
public void setAdditionalRepair(String additionalRepai) {
this.additionalRepair = additionalRepai;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getExpDeliveryDate() {
return expDeliveryDate;
}
public void setExpDeliveryDate(String expDeliveryDate) {
this.expDeliveryDate = expDeliveryDate;
}
public String getHours() {
return hours;
}
public void setHours(String hours) {
this.hours = hours;
}
public String getJobCardNo() {
return jobCardNo;
}
public void setJobCardNo(String jobCardNo) {
this.jobCardNo = jobCardNo;
}
public String getLabourDetails() {
return labourDetails;
}
public void setLabourDetails(String labourDetails) {
this.labourDetails = labourDetails;
}
public String getJobcarddate() {
return jobcarddate;
}
public void setJobcarddate(String jobcarddate) {
this.jobcarddate = jobcarddate;
}
public String getJobCloseDate() {
return jobCloseDate;
}
public void setJobCloseDate(String jobCloseDate) {
this.jobCloseDate = jobCloseDate;
}
public String getJobSource() {
return jobSource;
}
public void setJobSource(String jobSourrce) {
this.jobSource = jobSourrce;
}
public String getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}
public String getSerivceAdvName() {
return serivceAdvName;
}
public void setSerivceAdvName(String serivceAdvName) {
this.serivceAdvName = serivceAdvName;
}
public String getServDealerCode() {
return servDealerCode;
}
public void setServDealerCode(String servDealerCode) {
this.servDealerCode = servDealerCode;
}
public String getServiceHistry() {
return serviceHistry;
}
public void setServiceHistry(String serviceHistry) {
this.serviceHistry = serviceHistry;
}
public String getServiceSubType() {
return serviceSubType;
}
public void setServiceSubType(String serviceSubType) {
this.serviceSubType = serviceSubType;
}
public String getServiceType() {
return serviceType;
}
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
public String getTechnicianName() {
return technicianName;
}
public void setTechnicianName(String technicianName) {
this.technicianName = technicianName;
}
public String getTractorSrNo() {
return tractorSrNo;
}
public void setTractorSrNo(String tractorSrNo) {
this.tractorSrNo = tractorSrNo;
}
}
}
以上执行代码显示此类错误
Caused by: com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field com.bcone.mahindraGreenClub.response.JobCardResponse$Return.additionalrepair
---- Debugging information ----
field : additionalrepair
class : com.bcone.mahindraGreenClub.response.JobCardResponse$Return
required-type : com.bcone.mahindraGreenClub.response.JobCardResponse$Return
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /ns1:redcustomerviewResponse/jobcard/additionalrepair
line number : 8
class[1] : com.bcone.mahindraGreenClub.response.JobCardResponse
version : 0.0
在过去的两天里,我坚持这一点,但是没能离开这个。
答案 0 :(得分:0)
您将String
字段声明为static
,这意味着它们与类绑定,并且不是可以反序列化的对象的可变成员:
private static String additionalRepair;
您应该从所有这些字段中删除static
:
private String additionalRepair;