Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从C中的回复消息WSDL服务反序列化正文时出错#_C#_Xml_Wsdl_Webservices Client - Fatal编程技术网

C# 从C中的回复消息WSDL服务反序列化正文时出错#

C# 从C中的回复消息WSDL服务反序列化正文时出错#,c#,xml,wsdl,webservices-client,C#,Xml,Wsdl,Webservices Client,我已经创建了一个控制台应用程序,在其中使用web服务。我已经在SoapUI中测试了这项服务,看起来一切都很好,但是现在当我在C#中使用它时,我得到了上面的错误消息。我尝试在配置和代码中设置绑定,但仍然不起作用。我在谷歌上搜索了大多数文章,在这个错误中,我尝试将缓冲区大小和ReaderQuotas的属性增加到最大,但正如大多数文章所建议的那样,但仍然没有成功 请帮助我,因为我已经为此挣扎了大约一个星期了 输入字符串的格式不正确。 XML文档(43,9)中存在错误。 System.ServiceMo

我已经创建了一个控制台应用程序,在其中使用web服务。我已经在SoapUI中测试了这项服务,看起来一切都很好,但是现在当我在C#中使用它时,我得到了上面的错误消息。我尝试在配置和代码中设置绑定,但仍然不起作用。我在谷歌上搜索了大多数文章,在这个错误中,我尝试将缓冲区大小和ReaderQuotas的属性增加到最大,但正如大多数文章所建议的那样,但仍然没有成功

请帮助我,因为我已经为此挣扎了大约一个星期了

输入字符串的格式不正确。
XML文档(43,9)中存在错误。
System.ServiceModel.Dispatcher.XmlSerializePropertyFormatter.DeserializeBody(XmlDictionaryReader读取器,MessageVersion版本,XmlSerializer序列化器,MessagePartDescription returnPart,MessagePartDescriptionCollection bodyParts,对象[]参数,布尔值isRequest)
在System.ServiceModel.Dispatcher.XmlSerializeRopeFormatter.DeserializeBody(XmlDictionaryReader读取器,MessageVersion版本,字符串操作,MessageDescription MessageDescription,Object[]参数,Boolean isRequest)
位于System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContent(消息消息,对象[]参数,布尔值isRequest)
在System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(消息消息,对象[]参数)
位于System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc&rpc)
位于System.ServiceModel.Channels.ServiceChannel.HandlerReply(ProxyOperationRuntime操作,ProxyRpc&rpc)
在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime操作、对象[]输入、对象[]输出、时间跨度超时)
位于System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)
位于System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)

在[0]处重试异常:
在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage)中 reqMsg,IMessage retMsg)
在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData)中& msgData,Int32类型)
在CustomerDetails\u PortType.getCustomerDetails(getCustomerDetailsRequest 请求)
在CRMTestApp.Program.Main处(字符串[]args)

代码:

类程序
{
静态void Main(字符串[]参数)
{      
var myBinding=新的BasicHttpBinding(BasicHttpSecurityMode.None);
myBinding.Name=“EMMCRMIntegration\u webServices\u providers\u customerDetail\u Binder”;
myBinding.CloseTimeout=新的时间跨度(00,05,00);
myBinding.OpenTimeout=新的时间跨度(00,05,00);
myBinding.ReceiveTimeout=新的时间跨度(00,05,00);
myBinding.SendTimeout=新的时间跨度(00,05,00);
myBinding.TextEncoding=System.Text.Encoding.UTF8;
myBinding.MaxReceivedMessageSize=int.MaxValue;
myBinding.MaxBufferSize=int.MaxValue;
myBinding.ReaderQuotas.MaxStringContentLength=int.MaxValue;
myBinding.ReaderQuotas.MaxDepth=int.MaxValue;
myBinding.ReaderQuotas.MaxNameTableCharCount=int.MaxValue;
myBinding.ReaderQuotas.MaxArrayLength=int.MaxValue;
myBinding.ReaderQuotas.MaxBytesPerRead=int.MaxValue;
var myednPoint=新端点地址(“http://EMMBPMPROD02TST.ekurhuleni.gov.za:5555/ws/EMMCRMIntegration.webServices.providers:customerDetail/EMMCRMIntegration_webServices_providers_customerDetail_Port");
var myChannelFactory=新的ChannelFactory(myBinding,myednPoint);
customerDetail\u PortType客户端=null;
尝试
{
getCustomerDetailsRequest请求=新建getCustomerDetailsRequest();
request.customerDetailIn=新customerDetailIn();
request.customerDetailIn.emmAccountNo=“3902269211”;
//request.customerDetailIn.IDNumber=“880113838493”;
//request.customerDetailIn.standNo=“7266479”;
client=myChannelFactory.CreateChannel();
client.getCustomerDetails(请求);
//XmlSerializer xs=新的XmlSerializer()
//client.getCustomerDetails()
((ICommunicationObject)client.Close();
}
捕获(例外情况除外)
{
如果(客户端!=null)
{
((ICommunicationObject)client.Abort();
}
}
}
}


您有没有使用soap ui查看XML中的内容?(43,9)中有什么数据?是3985.19 XML中当前的平衡行,尽管我没有看到任何奇怪的东西here@OfirWinegarten请看我的编辑,我已经添加了我得到的SOAPUIXML响应,3985.19这是数据所在的行(43,9),看起来是正确的。尝试用svcutil@OfirWinegarten我尝试了这个建议,但仍然没有成功,我还尝试添加了一个服务引用而不是代理类,仍然是相同的错误?(43,9)中有什么数据?是3985.19 XML中当前的平衡行,尽管我没有看到任何奇怪的东西here@OfirWinegarten请看我的编辑,我已经添加了我得到的SOAPUIXML响应,3985.19这是数据所在的行(43,9),看起来是正确的。尝试用svcutil@OfirWinegarten我尝试了这个建议,但仍然没有成功,我还尝试添加服务引用而不是代理类,仍然是相同的错误。
class Program
{
    static void Main(string[] args)
    {      
        var myBinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
        myBinding.Name = "EMMCRMIntegration_webServices_providers_customerDetail_Binder";
        myBinding.CloseTimeout = new TimeSpan(00, 05, 00);
        myBinding.OpenTimeout = new TimeSpan(00, 05, 00);
        myBinding.ReceiveTimeout = new TimeSpan(00, 05, 00);
        myBinding.SendTimeout = new TimeSpan(00, 05, 00);
        myBinding.TextEncoding = System.Text.Encoding.UTF8;
        myBinding.MaxReceivedMessageSize = int.MaxValue;
        myBinding.MaxBufferSize = int.MaxValue;
        myBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
        myBinding.ReaderQuotas.MaxDepth = int.MaxValue;
        myBinding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
        myBinding.ReaderQuotas.MaxArrayLength = int.MaxValue;
        myBinding.ReaderQuotas.MaxBytesPerRead = int.MaxValue;          

        var myednPoint = new EndpointAddress("http://EMMBPMPROD02TST.ekurhuleni.gov.za:5555/ws/EMMCRMIntegration.webServices.providers:customerDetail/EMMCRMIntegration_webServices_providers_customerDetail_Port");
        var myChannelFactory = new ChannelFactory<customerDetail_PortType>(myBinding, myednPoint);

        customerDetail_PortType client = null;

        try
        {
            getCustomerDetailsRequest request = new getCustomerDetailsRequest();
            request.customerDetailIn = new customerDetailIn();

             request.customerDetailIn.emmAccountNo = "3902269211";
            //request.customerDetailIn.IDNumber = "880113838493";
            //request.customerDetailIn.standNo = "7266479";

            client = myChannelFactory.CreateChannel();
            client.getCustomerDetails(request);
            //XmlSerializer xs = new XmlSerializer()
            //client.getCustomerDetails()
            ((ICommunicationObject)client).Close();
        }
        catch (Exception ex)
        {
            if (client != null)
            {
                ((ICommunicationObject)client).Abort();
            }
        }
    }
}