I have a created a console application where I consume a web service. I have tested this service in SoapUI and everything seems to work fine but now when I consume it in C# I get the above error message. I tried setting up the binding in config and in code but it still doesn't work. I googled and searched most articles in this error I tried increasing the Buffer size and ReaderQuotas's properties to maximum but as suggested in most articles but still no luck.
Please assist me as I have been struggling with thus for about a week now.
Input string was not in a correct format.
There is an error in XML document (43, 9).
System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at customerDetail_PortType.getCustomerDetails(getCustomerDetailsRequest request)
at CRMTestApp.Program.Main(String[] args)
Code:
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>