提问人:user8253442 提问时间:10/5/2023 更新时间:10/5/2023 访问量:18
XML 反序列化不会读取所有参数
XML deserialization does not read all parameters
问:
我有这个回应来反序列化:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getidspedizionebyrmaResponse xmlns:ns2="http://getidspedizionebyrma.wsbeans.iseries/">
<return>
<ESITO>-11</ESITO>
<SPEDIZIONE_ID>0</SPEDIZIONE_ID>
<VERSIONE>0</VERSIONE>
</return>
</ns2:getidspedizionebyrmaResponse>
</soap:Body>
</soap:Envelope>
我编写了这个类来做到这一点:
[XmlRoot(ElementName = "Envelope", Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
public class SoapEnvelope
{
[XmlElement(Namespace = "http://schemas.xmlsoap.org/soap/envelope/")]
public Body Body { get; set; }
}
public class Body
{
[XmlElement(ElementName = "getidspedizionebyrmaResponse", Namespace = "http://getidspedizionebyrma.wsbeans.iseries/")]
public GetIdSpedizioneByRmaResponse getidspedizionebyrmaResponse { get; set; }
}
public class GetIdSpedizioneByRmaResponse
{
public getidspedizionebyrmaResult ReturnValue { get; set; }
}
public class getidspedizionebyrmaResult
{
public int ESITO { get; set; }
public int SPEDIZIONE_ID { get; set; }
public int VERSIONE { get; set; }
}
ReturnValue 始终为 null。也许命名空间存在一些问题?我哪里出了问题?谢谢
答: 暂无答案
评论