繁体   English   中英

WCF SOAP接收空列表

[英]WCF SOAP receive empty list

我有一个Android应用程序和一个WCF服务来存储数据。 我尝试使用Android应用程序(使用kSOAP2)向服务发送请求。 一切正常,但是..当我尝试将列表(简单字符串或整数列表)发送到服务时,WCF服务会接收该消息,但列表始终为空!

我的SOAP消息是这样的:

<MyList>
    <int>12</int>
    <int>50</int>
</MyList>

客户端或服务中没有错误...但是列表始终为空,我也不知道为什么。 有人知道WCF列表的正确格式吗?

提前致谢。

编辑:

我的服务界面:

[ServiceContract(Namespace = MyService.NamespaceV3)]
public interface IMyService
{
    [OperationContract]
    void MarkMessagesAsRead(List<int> ids, DateTime readDate, int employeeId);
}

参数readDate和employeeId可以正常工作,但是列表ID始终为空(不是null,而是空)。

编辑2:

我的完整要求是:

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
    <v:Header />
    <v:Body>
        <MarkMessagesAsRead xmlns="http://schemas.xxx.fr/Mobile">
            <ids><int>10293</int><int>10295</int></ids>
            <readDate i:type="d:DateTime">2015-10-19T16:32:44.04</readDate>
            <employeeId i:type="d:int">18572</employeeId>
        </MarkMessagesAsRead>
    </v:Body>
</v:Envelope>

好的,我找到了解决方案:我只是将正确的名称空间添加到列表中的“ int”元素。

用于数组和列表的名称空间是: http : //schemas.microsoft.com/2003/10/Serialization/Arrays

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM