使用.net C上的WSDL.exe创建代理Web服务时出错

时间:2015-01-16 14:59:23

标签: c# .net web-services wsdl wsdl.exe

我使用wsdl.exe创建了一个.cs类,但我无法在Web服务上实现它。当我尝试调用NewOperation()时,我遇到了一个错误,原始的wsdl在SOAPUI和.Net Studio上工作正常,但它很奇怪,因为它需要out strings而不是简单的DatosEntradaReisgo < / p>

这是我的.cs:

    using System.Diagnostics;
using System.Web.Services;
using System.ComponentModel;
using System.Web.Services.Protocols;
using System;
using System.Xml.Serialization;
using System.Configuration;

namespace Simulador.Bll.Servicio.WSTablaAmortizacionService
{
    //------------------------------------------------------------------------------
    // <auto-generated>
    //     This code was generated by a tool.
    //     Runtime Version:2.0.50727.3655
    //
    //     Changes to this file may cause incorrect behavior and will be lost if
    //     the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------


    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "TestSOAP", Namespace = "http://flujos.tcs.com/ConsultaReisgoGlobal")]
    public partial class Test : System.Web.Services.Protocols.SoapHttpClientProtocol
    {

        private System.Threading.SendOrPostCallback NewOperationOperationCompleted;

        /// <remarks/>
        public Test()
        {
            this.Url = "http://10.0.177.86:7080/CICSServer?programa=ConsultaReisgoGlobal";
        }

        /// <remarks/>
        public event NewOperationCompletedEventHandler NewOperationCompleted;

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://flujos.tcs.com/ConsultaReisgoGlobal/NewOperation", RequestElementName = "ejecutar", RequestNamespace = "http://flujos.tcs.com/ConsultaReisgoGlobal", ResponseElementName = "ResigoActivasResponse", ResponseNamespace = "http://flujos.tcs.com/ConsultaReisgoGlobal", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute("Segmento", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string NewOperation([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] DatosEntradaReisgo DatosEntradaReisgo, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out string Asessor, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out string Email_Esessor, [System.Xml.Serialization.XmlArrayAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] [System.Xml.Serialization.XmlArrayItemAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = false)] out Operacion[] Operaciones, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out string codError, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out string descError)
        {
            object[] results = this.Invoke("NewOperation", new object[] {
                    DatosEntradaReisgo});
            Asessor = ((string)(results[1]));
            Email_Esessor = ((string)(results[2]));
            Operaciones = ((Operacion[])(results[3]));
            codError = ((string)(results[4]));
            descError = ((string)(results[5]));
            return ((string)(results[0]));
        }

        /// <remarks/>
        public System.IAsyncResult BeginNewOperation(DatosEntradaReisgo DatosEntradaReisgo, System.AsyncCallback callback, object asyncState)
        {
            return this.BeginInvoke("NewOperation", new object[] {
                    DatosEntradaReisgo}, callback, asyncState);
        }

        /// <remarks/>
        public string EndNewOperation(System.IAsyncResult asyncResult, out string Asessor, out string Email_Esessor, out Operacion[] Operaciones, out string codError, out string descError)
        {
            object[] results = this.EndInvoke(asyncResult);
            Asessor = ((string)(results[1]));
            Email_Esessor = ((string)(results[2]));
            Operaciones = ((Operacion[])(results[3]));
            codError = ((string)(results[4]));
            descError = ((string)(results[5]));
            return ((string)(results[0]));
        }

        /// <remarks/>
        public void NewOperationAsync(DatosEntradaReisgo DatosEntradaReisgo)
        {
            this.NewOperationAsync(DatosEntradaReisgo, null);
        }

        /// <remarks/>
        public void NewOperationAsync(DatosEntradaReisgo DatosEntradaReisgo, object userState)
        {
            if ((this.NewOperationOperationCompleted == null))
            {
                this.NewOperationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnNewOperationOperationCompleted);
            }
            this.InvokeAsync("NewOperation", new object[] {
                    DatosEntradaReisgo}, this.NewOperationOperationCompleted, userState);
        }

        private void OnNewOperationOperationCompleted(object arg)
        {
            if ((this.NewOperationCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.NewOperationCompleted(this, new NewOperationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://flujos.tcs.com/ConsultaReisgoGlobal")]
    public partial class DatosEntradaReisgo
    {

        private string nUMERODEIDENTIFICACIONField;

        private string tIPODEIDENTIFICACIONField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string NUMERODEIDENTIFICACION
        {
            get
            {
                return this.nUMERODEIDENTIFICACIONField;
            }
            set
            {
                this.nUMERODEIDENTIFICACIONField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string TIPODEIDENTIFICACION
        {
            get
            {
                return this.tIPODEIDENTIFICACIONField;
            }
            set
            {
                this.tIPODEIDENTIFICACIONField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://flujos.tcs.com/ConsultaReisgoGlobal")]
    public partial class Garantia
    {

        private string valorGarantiaField;

        private string valorDeAvaluoField;

        private string descripcionDeGarantiaField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string ValorGarantia
        {
            get
            {
                return this.valorGarantiaField;
            }
            set
            {
                this.valorGarantiaField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string ValorDeAvaluo
        {
            get
            {
                return this.valorDeAvaluoField;
            }
            set
            {
                this.valorDeAvaluoField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string DescripcionDeGarantia
        {
            get
            {
                return this.descripcionDeGarantiaField;
            }
            set
            {
                this.descripcionDeGarantiaField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://flujos.tcs.com/ConsultaReisgoGlobal")]
    public partial class Garantias
    {

        private Garantia garantiaField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public Garantia Garantia
        {
            get
            {
                return this.garantiaField;
            }
            set
            {
                this.garantiaField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://flujos.tcs.com/ConsultaReisgoGlobal")]
    public partial class Operacion
    {

        private string numeroOperacionField;

        private string descripTipoCreditoField;

        private string descripOperSARField;

        private string valorVigenteField;

        private string diasMoraField;

        private string capitalVencidoField;

        private Garantias[] garantiasField;

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string NumeroOperacion
        {
            get
            {
                return this.numeroOperacionField;
            }
            set
            {
                this.numeroOperacionField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string DescripTipoCredito
        {
            get
            {
                return this.descripTipoCreditoField;
            }
            set
            {
                this.descripTipoCreditoField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string DescripOperSAR
        {
            get
            {
                return this.descripOperSARField;
            }
            set
            {
                this.descripOperSARField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string ValorVigente
        {
            get
            {
                return this.valorVigenteField;
            }
            set
            {
                this.valorVigenteField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string DiasMora
        {
            get
            {
                return this.diasMoraField;
            }
            set
            {
                this.diasMoraField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public string CapitalVencido
        {
            get
            {
                return this.capitalVencidoField;
            }
            set
            {
                this.capitalVencidoField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute("Garantias", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public Garantias[] Garantias
        {
            get
            {
                return this.garantiasField;
            }
            set
            {
                this.garantiasField = value;
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    public delegate void NewOperationCompletedEventHandler(object sender, NewOperationCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.17929")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class NewOperationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal NewOperationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
            base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public string Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[0]));
            }
        }

        /// <remarks/>
        public string Asessor
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[1]));
            }
        }

        /// <remarks/>
        public string Email_Esessor
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[2]));
            }
        }

        /// <remarks/>
        public Operacion[] Operaciones
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((Operacion[])(this.results[3]));
            }
        }

        /// <remarks/>
        public string codError
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[4]));
            }
        }

        /// <remarks/>
        public string descError
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[5]));
            }
        }
    }

}

这是我的实现

  [WebMethod]
        public string  NewOperation(DatosEntradaReisgo DatosEntradaReisgoIN,string  asessor,string  email,Operacion[] Ops,string codErr, string descErr )
        {
            string respuesta ;

            using (Test servicio = new Test())
            {
                respuesta = servicio.NewOperation(DatosEntradaReisgoIN,asessor,email,Ops,codErr,descErr);
            }
            return respuesta;
        }

1 个答案:

答案 0 :(得分:0)

Ty改变以下行

respuesta = servicio.NewOperation(DatosEntradaReisgoIN,asessor,email,Ops,codErr,descErr);

respuesta = servicio.NewOperation(DatosEntradaReisgoIN,out asessor,out email,out Ops,out codErr,out descErr);