首先,我想说我知道这种老技术,如果由我来决定生活会有所不同。我对这项老技术相对较新,我正在扩展现有的服务工作,我遇到了一个奇怪的问题。我有3个服务端点,其中2个正在按预期工作,但我的第三个问题是“框架”如何无法反序列化xml请求。
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<UpdateSale xmlns="http://tokenws.netgen.co.za/">
<p_objrequest>
<transactionTypeId>1</transactionTypeId>
<tenderTypeId>1</tenderTypeId>
<standardHeader>
<requestId xmlns="">1_8</requestId>
<localeId xmlns="" />
<systemId xmlns="">asdf</systemId>
<batchReference xmlns="">11</batchReference>
</standardHeader>
<account>
<accountId xmlns="">123</accountId>
<pin xmlns="" >123</pin>
</account>
<amount>
<valueCode xmlns="">ZAR</valueCode>
<enteredAmount xmlns="">30</enteredAmount>
<nsfAllowed xmlns="">N</nsfAllowed>
</amount>
<lineItems>
<LineItem>
<productCode>1</productCode>
<categoryCode>1</categoryCode>
<qty>1</qty>
<price>50</price>
<discountedPrice>0</discountedPrice>
<description>Buffet Breakfast</description>
</LineItem>
</lineItems>
</p_objrequest>
<netCredentials>
<UserName xmlns="http://tempuri.org/">123</UserName>
<Password xmlns="http://tempuri.org/">123</Password>
</netCredentials>
</UpdateSale>
</soap:Body>
</soap:Envelope>
上面是xml,netCredentials正确反序列化,但p_objrequest为null。
如果你遇到过这个问题并得到解决,如果你能引导我走向正确的方向,我将非常感激。
先谢谢。
修改
以下是课程
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://tokenws.netgen.co.za/")]
public class Sale
{
private int transactionTypeIdField;
private int tenderTypeIdField;
private RequestStandardHeaderComponent standardHeaderField;
private AccountComponent accountField;
private string activatingField;
private AmountComponent amountField;
private CustomerInfoComponent customerInfoField;
private PromotionCode[] promotionCodesField;
private QuestionAndAnswer[] questionsAndAnswersField;
private LineItem[] lineItemsField;
private string includeTipField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 0)]
public int transactionTypeId
{
get
{
return this.transactionTypeIdField;
}
set
{
this.transactionTypeIdField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 1)]
public int tenderTypeId
{
get
{
return this.tenderTypeIdField;
}
set
{
this.tenderTypeIdField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 2)]
public RequestStandardHeaderComponent standardHeader
{
get
{
return this.standardHeaderField;
}
set
{
this.standardHeaderField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 3)]
public AccountComponent account
{
get
{
return this.accountField;
}
set
{
this.accountField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 4)]
public string activating
{
get
{
return this.activatingField;
}
set
{
this.activatingField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 5)]
public AmountComponent amount
{
get
{
return this.amountField;
}
set
{
this.amountField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 6)]
public CustomerInfoComponent customerInfo
{
get
{
return this.customerInfoField;
}
set
{
this.customerInfoField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Order = 7)]
public PromotionCode[] promotionCodes
{
get
{
return this.promotionCodesField;
}
set
{
this.promotionCodesField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Order = 8)]
public QuestionAndAnswer[] questionsAndAnswers
{
get
{
return this.questionsAndAnswersField;
}
set
{
this.questionsAndAnswersField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Order = 9)]
public LineItem[] lineItems
{
get
{
return this.lineItemsField;
}
set
{
this.lineItemsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order = 10)]
public string includeTip
{
get
{
return this.includeTipField;
}
set
{
this.includeTipField = value;
}
}
}