NetCFSvcUtil 生成的客户端忽略 int 和 long 属性
我在为 WCF 服务生成客户端时遇到问题。 问题是它在将请求转换为soap 时忽略了一些字段。 它仅传输字符串字段。
这是我需要传输的类:
[DataContract]
public class PersonCriteria : CriteriaBase
{
[DataMember]
public long ID { get; set; }
[DataMember]
public string JMBG { get; set; }
[DataMember]
public string Fname { get; set; }
[DataMember]
public string Lname { get; set; }
[DataMember]
public long IdentityCardNumber { get; set; }
[DataMember]
public int DrivingCardNumber { get; set; }
}
这是肥皂请求:
{<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IPersonsService/GetPerson</Action>
</s:Header>
<s:Body>
<GetPerson xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<personReq>
<Criteria xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Messages.Requests">
<Fname xsi:nil="true" xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Criteria" />
<JMBG xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Criteria">1</JMBG>
<Lname xsi:nil="true" xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Criteria" />
</Criteria>
</personReq>
</GetPerson>
</s:Body>
</s:Envelope>}
我尝试将某些字段更改为字符串或整数,但它总是只传输字符串字段。 我正在使用适用于 Windows 7 的 netcfsvcutil(一些更新)。 可能是什么问题?
I have problem with generated client for WCF service.
Problem is that it ignores some fields when it converts request to soap.
It only transfers string fields.
This is my class which needs to be transfered:
[DataContract]
public class PersonCriteria : CriteriaBase
{
[DataMember]
public long ID { get; set; }
[DataMember]
public string JMBG { get; set; }
[DataMember]
public string Fname { get; set; }
[DataMember]
public string Lname { get; set; }
[DataMember]
public long IdentityCardNumber { get; set; }
[DataMember]
public int DrivingCardNumber { get; set; }
}
And this is soap request:
{<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IPersonsService/GetPerson</Action>
</s:Header>
<s:Body>
<GetPerson xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<personReq>
<Criteria xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Messages.Requests">
<Fname xsi:nil="true" xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Criteria" />
<JMBG xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Criteria">1</JMBG>
<Lname xsi:nil="true" xmlns="http://schemas.datacontract.org/2004/07/Mibo.PoliceDemo.PersonsService.Criteria" />
</Criteria>
</personReq>
</GetPerson>
</s:Body>
</s:Envelope>}
I've tried to change some fields to string or int and it always transfers only string fields.
I'am using netcfsvcutil for windows 7 (some update).
What could be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论