C#无法从SOAP服务中读取嵌套节点

时间:2015-07-20 18:03:24

标签: c# web-services soap

我正在调用SOAP服务,该服务返回一个XML响应,我将其捕获为服务合同中指定的类型。响应将某些嵌套节点显示为null,即使我在Fiddler中查看原始响应时,节点也包含数据。查看服务生成的Reference.cs类,所有节点都指定了正确的XML命名空间。我想也许它与basicHttpBinding有关,但这只是一个猜测。下面是我的装订,价值很高,直到我开始工作。

BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "ServiceSoapBinding";
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.AllowCookies = true;
binding.MaxReceivedMessageSize = 20000000;
binding.MaxBufferSize = 20000000;
binding.MaxBufferPoolSize = 20000000;
binding.ReaderQuotas.MaxDepth = 32;
binding.ReaderQuotas.MaxArrayLength = 20000000;
binding.ReaderQuotas.MaxStringContentLength = 20000000;
EndpointAddress address = new EndpointAddress("https://serviceURL");
var client = new ServiceClient(binding, address);

下面是响应看到为null的类,即使我知道该服务正在返回数据:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34234")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://NamespaceURL")]
public partial class CustomerType: object, System.ComponentModel.INotifyPropertyChanged
{...}

有什么想法吗?

0 个答案:

没有答案