C# .NET WCF服务客户端响应空值,即使存在';soap响应中的数据

C# .NET WCF服务客户端响应空值,即使存在';soap响应中的数据,c#,web-services,wcf,soap,wsdl,C#,Web Services,Wcf,Soap,Wsdl,我已经创建了一个WCF服务客户端,它自动为我创建了服务引用,并且发送SOAP请求消息的工作方式与预期的一样,但是当我收到SOAP响应时,我从信封接收数据,但是服务客户端返回为空。我已经研究了几个讨论这个问题的问题,它似乎总是与名称空间问题有关,但名称空间似乎是匹配的。属性的名称似乎也排成一行。我有一个我收到的SOAP消息和生成的服务引用的示例: <soapenv:Envelope xmlns:gec="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS" xm

我已经创建了一个WCF服务客户端,它自动为我创建了服务引用,并且发送SOAP请求消息的工作方式与预期的一样,但是当我收到SOAP响应时,我从信封接收数据,但是服务客户端返回为空。我已经研究了几个讨论这个问题的问题,它似乎总是与名称空间问题有关,但名称空间似乎是匹配的。属性的名称似乎也排成一行。我有一个我收到的SOAP消息和生成的服务引用的示例:

<soapenv:Envelope xmlns:gec="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soapenv:Header />
      <soapenv:Body>
<gec:GECSNIncidentResponse>
  <AssetName>Web</AssetName>
  <RequestId>CAPINC0185961</RequestId>
  <BriefDesc>\DEV_Region\WEB\TEST_JAMS_SONIC</BriefDesc>
  <AssignedGroup>@ELEC INS IT/Operations</AssignedGroup>
  <TranStatus>SUCCESS</TranStatus>
  <RequestURL>https://gecapqa.service-now.com/nav_to.do?uri=incident.do?sys_id=443fd14b0f0df68070a401cce1050e2c</RequestURL>
  <CreatedBy />
  <Error>
  <ErrorCode />
      <ErrorDetails />
     </Error>
    </gec:GECSNIncidentResponse>
   </soapenv:Body>
</soapenv:Envelope>

网状物
CAPINC0185961
\开发区\WEB\TEST\u JAMS\u SONIC
@电子资讯科技/操作
成功
https://gecapqa.service-now.com/nav_to.do?uri=incident.do?sys_id=443fd14b0f0df68070a401cce1050e2c
这是客户:

   namespace GESonicService.GESonic_Service {


    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS", ConfigurationName="GESonic_Service.GECSNIncidentWSPortType")]
    public interface GECSNIncidentWSPortType {
    [System.ServiceModel.OperationContractAttribute(Action="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS/#Open", ReplyAction="*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
        GESonicService.GESonic_Service.OpenResponse1 Open(GESonicService.GESonic_Service.OpenRequest request);

        [System.ServiceModel.OperationContractAttribute(Action="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS/#Open", ReplyAction="*")]
        System.Threading.Tasks.Task<GESonicService.GESonic_Service.OpenResponse1> OpenAsync(GESonicService.GESonic_Service.OpenRequest request);
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1064.2")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS")]
    public partial class OpenInput : object, System.ComponentModel.INotifyPropertyChanged {

        private OpenInputTranInfo tranInfoField;

        private OpenInputTradPartInfo tradPartInfoField;

        private OpenInputRequestInfo requestInfoField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
        public OpenInputTranInfo TranInfo {
            get {
                return this.tranInfoField;
            }
            set {
                this.tranInfoField = value;
                this.RaisePropertyChanged("TranInfo");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
        public OpenInputTradPartInfo TradPartInfo {
            get {
                return this.tradPartInfoField;
            }
            set {
                this.tradPartInfoField = value;
                this.RaisePropertyChanged("TradPartInfo");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
        public OpenInputRequestInfo RequestInfo {
            get {
                return this.requestInfoField;
            }
            set {
                this.requestInfoField = value;
                this.RaisePropertyChanged("RequestInfo");
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1064.2")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS")]
    public partial class OpenInputTranInfo : object, System.ComponentModel.INotifyPropertyChanged {

        private string tranIdField;

        private string interfaceTypeField;

        private string requestTypeField;

        private string tranNameField;

        public OpenInputTranInfo() {
            this.interfaceTypeField = "webservice";
            this.requestTypeField = "incident";
            this.tranNameField = "open";
        }[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
        public string TranId {
            get {
                return this.tranIdField;
            }
            set {
                this.tranIdField = value;
                this.RaisePropertyChanged("TranId");
            }
        }[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
        public string InterfaceType {
            get {
                return this.interfaceTypeField;
            }
            set {
                this.interfaceTypeField = value;
                this.RaisePropertyChanged("InterfaceType");
            }
        }[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
        public string RequestType {
            get {
                return this.requestTypeField;
            }
            set {
                this.requestTypeField = value;
                this.RaisePropertyChanged("RequestType");
            }
        }[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
        public string TranName {
            get {
                return this.tranNameField;
            }
            set {
                this.tranNameField = value;
                this.RaisePropertyChanged("TranName");
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1064.2")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS")]
    public partial class OpenResponse : object, System.ComponentModel.INotifyPropertyChanged {

        private string assetNameField;

        private string requestIdField;

        private string briefDescField;

        private string assignedGroupField;

        private string tranStatusField;

        private string requestURLField;

        private string createdByField;

        private OpenResponseError errorField;

        private string originalDocumentField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
        public string AssetName {
            get {
                return this.assetNameField;
            }
            set {
                this.assetNameField = value;
                this.RaisePropertyChanged("AssetName");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
        public string RequestId {
            get {
                return this.requestIdField;
            }
            set {
                this.requestIdField = value;
                this.RaisePropertyChanged("RequestId");
            }
        }[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
        public string BriefDesc {
            get {
                return this.briefDescField;
            }
            set {
                this.briefDescField = value;
                this.RaisePropertyChanged("BriefDesc");
            }
        }[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
        public string AssignedGroup {
            get {
                return this.assignedGroupField;
            }
            set {
                this.assignedGroupField = value;
                this.RaisePropertyChanged("AssignedGroup");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=4)]
        public string TranStatus {
            get {
                return this.tranStatusField;
            }
            set {
                this.tranStatusField = value;
                this.RaisePropertyChanged("TranStatus");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=5)]
        public string RequestURL {
            get {
                return this.requestURLField;
            }
            set {
                this.requestURLField = value;
                this.RaisePropertyChanged("RequestURL");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=6)]
        public string CreatedBy {
            get {
                return this.createdByField;
            }
            set {
                this.createdByField = value;
                this.RaisePropertyChanged("CreatedBy");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=7)]
        public OpenResponseError Error {
            get {
                return this.errorField;
            }
            set {
                this.errorField = value;
                this.RaisePropertyChanged("Error");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=8)]
        public string OriginalDocument {
            get {
                return this.originalDocumentField;
            }
            set {
                this.originalDocumentField = value;
                this.RaisePropertyChanged("OriginalDocument");
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1064.2")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn:GECSNIncidentWS/WSDL/GECSNIncidentWS")]
    public partial class OpenResponseError : object, System.ComponentModel.INotifyPropertyChanged {

        private string errorCodeField;

        private string errorDetailsField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
        public string ErrorCode {
            get {
                return this.errorCodeField;
            }
            set {
                this.errorCodeField = value;
                this.RaisePropertyChanged("ErrorCode");
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
        public string ErrorDetails {
            get {
                return this.errorDetailsField;
            }
            set {
                this.errorDetailsField = value;
                this.RaisePropertyChanged("ErrorDetails");
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class OpenResponse1 {

        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=0)]
        public GESonicService.GESonic_Service.OpenResponse GECSNIncidentResponse;

        public OpenResponse1() {
        }

        public OpenResponse1(GESonicService.GESonic_Service.OpenResponse GECSNIncidentResponse) {
            this.GECSNIncidentResponse = GECSNIncidentResponse;
        }
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface GECSNIncidentWSPortTypeChannel : GESonicService.GESonic_Service.GECSNIncidentWSPortType, System.ServiceModel.IClientChannel {
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class GECSNIncidentWSPortTypeClient : System.ServiceModel.ClientBase<GESonicService.GESonic_Service.GECSNIncidentWSPortType>, GESonicService.GESonic_Service.GECSNIncidentWSPortType {

        public GECSNIncidentWSPortTypeClient() {
        }

        public GECSNIncidentWSPortTypeClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }

        public GECSNIncidentWSPortTypeClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }

        public GECSNIncidentWSPortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }

        public GECSNIncidentWSPortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        GESonicService.GESonic_Service.OpenResponse1 GESonicService.GESonic_Service.GECSNIncidentWSPortType.Open(GESonicService.GESonic_Service.OpenRequest request) {
            return base.Channel.Open(request);
        }

        public GESonicService.GESonic_Service.OpenResponse Open(GESonicService.GESonic_Service.OpenInput Open1) {
            GESonicService.GESonic_Service.OpenRequest inValue = new GESonicService.GESonic_Service.OpenRequest();
            inValue.Open = Open1;
            GESonicService.GESonic_Service.OpenResponse1 retVal = ((GESonicService.GESonic_Service.GECSNIncidentWSPortType)(this)).Open(inValue);
            return retVal.GECSNIncidentResponse;
        }        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<GESonicService.GESonic_Service.OpenResponse1> GESonicService.GESonic_Service.GECSNIncidentWSPortType.OpenAsync(GESonicService.GESonic_Service.OpenRequest request) {
            return base.Channel.OpenAsync(request);
        }

        public System.Threading.Tasks.Task<GESonicService.GESonic_Service.OpenResponse1> OpenAsync(GESonicService.GESonic_Service.OpenInput Open) {
            GESonicService.GESonic_Service.OpenRequest inValue = new GESonicService.GESonic_Service.OpenRequest();
            inValue.Open = Open;
            return ((GESonicService.GESonic_Service.GECSNIncidentWSPortType)(this)).OpenAsync(inValue);
        }
    }
}
namespace GESonicService.GESonic\u服务{
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceModel”,“4.0.0.0”)]
[System.ServiceModel.ServiceContractAttribute(Namespace=“urn:GECSNIncidentWS/WSDL/GECSNIncidentWS”,ConfigurationName=“GESonic_Service.GECSNIncidentWSPortType”)]
公共接口GECSNIncidentWSPortType{
[System.ServiceModel.OperationContractAttribute(Action=“urn:GECSNIncidentWS/WSDL/GECSNIncidentWS/#Open”,ReplyAction=“*”)]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
GESonicService.GESonic_Service.OpenResponse1打开(GESonicService.GESonic_Service.OpenRequest请求);
[System.ServiceModel.OperationContractAttribute(Action=“urn:GECSNIncidentWS/WSDL/GECSNIncidentWS/#Open”,ReplyAction=“*”)]
System.Threading.Tasks.Task OpenAsync(GESonicService.GESonic_Service.OpenRequest);
}
/// 
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Xml”,“4.6.1064.2”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(Namespace=“urn:GECSNIncidentWS/WSDL/GECSNIncidentWS”)]
公共部分类OpenInput:对象,System.ComponentModel.INotifyPropertyChanged{
私有OpenInputRaninfo tranInfoField;
私有OpenInputRadPartInfo TradPartInfo字段;
私有OpenInputRequestInfo请求信息字段;
/// 
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=0)]
公共OpenInfoTranInfo{
得到{
返回此.tranfofield;
}
设置{
this.tranfofield=值;
本.RaisePropertyChanged(“TranInfo”);
}
}
/// 
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=1)]
公共OpenInputRadPartInfo TradPartInfo{
得到{
返回此.tradpartinfo字段;
}
设置{
this.tradpartinfo字段=值;
本.RaisePropertyChanged(“TradPartInfo”);
}
}
/// 
[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=2)]
公共OpenInputRequestInfo请求信息{
得到{
返回此.requestInfoField;
}
设置{
this.requestInfoField=值;
此.RaisePropertyChanged(“RequestInfo”);
}
}
公共事件System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
受保护的void RaisePropertyChanged(字符串propertyName){
System.ComponentModel.PropertyChangedEventHandler propertyChanged=this.propertyChanged;
如果((propertyChanged!=null)){
propertyChanged(这是新的System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute(“System.Xml”,“4.6.1064.2”)]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute(“代码”)]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true,Namespace=“urn:GECSNIncidentWS/WSDL/GECSNIncidentWS”)]
公共部分类OpenInputTranInfo:对象,System.ComponentModel.INotifyPropertyChanged{
私有字符串传输字段;
私有字符串接口字段;
私有字符串requestTypeField;
私有字符串transnamefield;
公共OpenInfo(){
this.interfaceTypeField=“webservice”;
this.requestTypeField=“事件”;
this.tranNameField=“打开”;
}[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=0)]
公共字符串TranId{
得到{
返回此.tranifield;
}
设置{
this.tranIdField=值;
本.RaisePropertyChanged(“TranId”);
}
}[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=1)]
公共字符串接口类型{
得到{
返回此.interfaceTypeField;
}
设置{
this.interfaceTypeField=值;
此.RaisePropertyChanged(“接口类型”);
}
}[System.Xml.Serialization.xmlementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,Order=2)]
公共字符串请求类型{
得到{
返回此.requestTypeField;
}
设置{
this.requestTypeField=值;
this.RaisePropertyChanged(“RequestType”);
}
}[System.Xml.Serialization.xmlle]