【发布时间】:2017-01-26 12:13:24
【问题描述】:
我尝试向服务器发送肥皂请求。我有这种肥皂形式,其中 urn:fetchType 是 FetchType 类型的枚举值:
public enum FetchType
{
AllDetails = 0,
OnlyRoot = 1
}
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="***">
<soapenv:Header/>
<soapenv:Body>
<urn:GetEventList>
<!--Optional:-->
<urn:sessionId></urn:sessionId>
<!--Optional:-->
<urn:filterXml></urn:filterXml>
<urn:fetchType></urn:fetchType>
<urn:subscribe></urn:subscribe>
</urn:GetEventList>
</soapenv:Body>
</soapenv:Envelope>
当我尝试发送 1 或 2 时,我收到错误响应:实例验证错误:'1' 不是 FetchType 的有效值。
我还尝试传递类似 FetchType.AllDetails 的内容并获得响应:Instance validation error: 'FetchType.AllDetails1' is not a valid value for FetchType.
等等...不同的解决方案。
这是应该接收请求的方法的签名:
public byte[] GetEventList(string sessionId, [XmlElement(DataType = base64Binary")] byte[] filterXml, FetchType fetchType, bool subscribe)
{ ... some code ...; }
你能告诉我我可以用什么方法来传递枚举值吗?
谢谢! :)
【问题讨论】:
标签: c# web-services soap enums