我创建了一个控制台应用程序,我在其中使用Web服务。我已经在SoapUI中测试了这个服务,一切似乎工作正常,但现在当我在C#中使用它时,我收到上面的错误消息。我尝试在配置和代码中设置绑定但它仍然无法正常工作。我搜索并搜索了此错误中的大多数文章我尝试将缓冲区大小和ReaderQuotas的属性增加到最大但是在大多数文章中建议但仍然没有运气。
请帮助我,因为我一直在努力工作一周左右。
输入字符串的格式不正确 XML文档中存在错误(43,49) System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader,MessageVersion version,XmlSerializer serializer,MessagePartDescription returnPart,MessagePartDescriptionCollection bodyParts,Object []参数,Boolean isRequest)
在System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader,MessageVersion version,String action,MessageDescription messageDescription,Object [] parameters,Boolean isRequest)
在System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(消息消息,Object []参数,布尔isRequest)
在System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(消息消息,对象[]参数)
在System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
在System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc& rpc)
在System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Object [] ins,Object [] outs,TimeSpan timeout)
在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)
在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)在[0]处重新抛出异常:
在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32类型)
at customerDetail_PortType.getCustomerDetails(getCustomerDetailsRequest 请求)
在CRMTestApp.Program.Main(String [] args)
代码:
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();
}
}
}
}
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapjms="http://www.w3.org/2010/soapjms/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://EMMGERMBPM-Test.ekurhuleni.gov.za/EMMCRMIntegration/webServices/providers/customerDetail" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="customerDetail" targetNamespace="http://EMMGERMBPM-Test.ekurhuleni.gov.za/EMMCRMIntegration/webServices/providers/customerDetail">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://EMMGERMBPM-Test.ekurhuleni.gov.za/EMMCRMIntegration/webServices/providers/customerDetail" targetNamespace="http://EMMGERMBPM-Test.ekurhuleni.gov.za/EMMCRMIntegration/webServices/providers/customerDetail">
<xsd:element name="getCustomerDetails" type="tns:getCustomerDetails"/>
<xsd:element name="getCustomerDetailsResponse" type="tns:getCustomerDetailsResponse"/>
<xsd:complexType name="getCustomerDetails">
<xsd:sequence>
<xsd:element name="customerDetailIn" nillable="true" type="tns:customerDetailIn"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="customerDetailIn">
<xsd:sequence>
<xsd:element name="emmAccountNo" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="IDNumber" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="standNo" nillable="true" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="getCustomerDetailsResponse">
<xsd:sequence>
<xsd:element name="customerDetailOut" nillable="true" type="tns:CRMCanonical"/>
<xsd:element name="ErrorDoc" nillable="true" type="tns:ErrorDoc"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CRMCanonical">
<xsd:sequence>
<xsd:element name="customerDetails" nillable="true" type="tns:customerDetailOut" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="customerDetailOut">
<xsd:sequence>
<xsd:element name="propertyDetails" nillable="true" type="tns:propertyDetails" minOccurs="0"/>
<xsd:element name="customerContactDetails" nillable="true" type="tns:customerContactDetails" minOccurs="0"/>
<xsd:element name="customerAccountStatus" nillable="true" type="tns:customerAccountStatus"/>
<xsd:element name="customerBalanceDetails" nillable="true" type="tns:customerBalanceDetails" minOccurs="0"/>
<xsd:element name="utilityBalanceDetails" nillable="true" type="tns:utilityBalanceDetails" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="propertyDetails">
<xsd:sequence>
<xsd:element name="propertyNo" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="closestCCCLocation" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="latitude" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="longitude" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="street1" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="street2" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="street3" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="streetCode" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="city" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="province" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="country" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="wardNo" nillable="true" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="customerContactDetails">
<xsd:sequence>
<xsd:element name="IDNumber" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="passportNumber" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="companyRegistartionNo" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="vatNumber" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="fullName" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="postalAddress1" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="postalAddress2" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="postalAddress3" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="postalAddress4" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="postalCode" nillable="true" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="customerAccountStatus">
<xsd:sequence>
<xsd:element name="venusAccountNo" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="ownership" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="indigentStatus" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="disconnectionStatus" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="disconnectionDate" nillable="true" type="xsd:string" minOccurs="0"/>
<xsd:element name="disconnectionRequireAmount" nillable="true" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="customerBalanceDetails">
<xsd:sequence>
<xsd:element name="previousBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="currentBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="totalBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="ageAnalysis" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="dateUpdated" nillable="true" type="xsd:date" minOccurs="0"/>
<xsd:element name="advanceAmount" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="totalAmount" nillable="true" type="xsd:double" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="utilityBalanceDetails">
<xsd:sequence>
<xsd:element name="waterBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="electricityBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="gasBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="refuseBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="ratesBalance" nillable="true" type="xsd:double" minOccurs="0"/>
<xsd:element name="sundriesBalance" nillable="true" type="xsd:double" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ErrorDoc">
<xsd:sequence>
<xsd:element name="errorFlag" nillable="true" type="xsd:string"/>
<xsd:element name="errorMessage" nillable="true" type="xsd:string"/>
<xsd:element name="errorCode" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="customerDetail_PortType_getCustomerDetailsResponse">
<wsdl:part name="parameters" element="tns:getCustomerDetailsResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="customerDetail_PortType_getCustomerDetails">
<wsdl:part name="parameters" element="tns:getCustomerDetails"></wsdl:part>
</wsdl:message>
<wsdl:portType name="customerDetail_PortType">
<wsdl:operation name="getCustomerDetails">
<wsdl:input message="tns:customerDetail_PortType_getCustomerDetails"></wsdl:input>
<wsdl:output message="tns:customerDetail_PortType_getCustomerDetailsResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="EMMCRMIntegration_webServices_providers_customerDetail_Binder" type="tns:customerDetail_PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getCustomerDetails">
<soap:operation soapAction="EMMCRMIntegration_webServices_providers_customerDetail_Binder_getCustomerDetails" style="document"/>
<wsdl:input>
<soap:body parts="parameters" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body parts="parameters" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="customerDetail">
<wsdl:port name="EMMCRMIntegration_webServices_providers_customerDetail_Port" binding="tns:EMMCRMIntegration_webServices_providers_customerDetail_Binder">
<soap:address location="http://EMMBPMPROD02TST.ekurhuleni.gov.za:5555/ws/EMMCRMIntegration.webServices.providers:customerDetail/EMMCRMIntegration_webServices_providers_customerDetail_Port"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
XML
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ser-root:getCustomerDetailsResponse xmlns:ser-root="http://EMMGERMBPM-Test.ekurhuleni.gov.za/EMMCRMIntegration/webServices/providers/customerDetail">
<customerDetailOut>
<customerDetails>
<propertyDetails>
<propertyNo>V01000000000040000000000000</propertyNo>
<closestCCCLocation>Mackenzieville</closestCCCLocation>
<latitude/>
<longitude/>
<street1>94</street1>
<street2>Balfour</street2>
<street3>Road</street3>
<streetCode/>
<city>Nigel</city>
<province/>
<country/>
<wardNo>88</wardNo>
</propertyDetails>
<customerContactDetails>
<IDNumber/>
<passportNumber/>
<companyRegistartionNo>2009/067175/23</companyRegistartionNo>
<vatNumber/>
<fullName>Tayyibah Prop Cc</fullName>
<postalAddress1>P O Box 185</postalAddress1>
<postalAddress2>Nigel</postalAddress2>
<postalAddress3/>
<postalAddress4/>
<postalCode>1490</postalCode>
</customerContactDetails>
<customerAccountStatus>
<venusAccountNo>3902269211</venusAccountNo>
<ownership>O</ownership>
<indigentStatus>B</indigentStatus>
<disconnectionStatus>NORMAL</disconnectionStatus>
<disconnectionDate/>
<disconnectionRequireAmount>0.00</disconnectionRequireAmount>
</customerAccountStatus>
<customerBalanceDetails>
<previousBalance/>
<currentBalance>3985.19</currentBalance>
<totalBalance/>
<ageAnalysis/>
<dateUpdated/>
<advanceAmount/>
<totalAmount/>
</customerBalanceDetails>
<utilityBalanceDetails>
<waterBalance/>
<electricityBalance/>
<gasBalance/>
<refuseBalance/>
<ratesBalance/>
<sundriesBalance/>
</utilityBalanceDetails>
</customerDetails>
</customerDetailOut>
<ErrorDoc>
<errorFlag/>
<errorMessage>ARCGIS service to retrieve property details is down</errorMessage>
<errorCode>106</errorCode>
</ErrorDoc>
</ser-root:getCustomerDetailsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>