views:

4264

answers:

5

this morning I ran into an issue with returning back a text string as result from a Web Service call. the Error I was getting is below

************** Exception Text **************
System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'GetFilingTreeXML'. ---> System.InvalidOperationException: There is an error in XML document (1, 9201). ---> System.Xml.XmlException: The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 9201.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowMaxStringContentLengthExceeded(XmlDictionaryReader reader, Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderImageServerClientInterfaceSoap.Read10_GetFilingTreeXMLResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer9.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
--- End of inner exception stack trace ---

did a search and the results are below: Search Results

most of those are WCF related but were enough to point me in the right direction. I will post answer as reply.

+1  A: 

from the results of the search the third item was pretty much what I pointed in right direction.

Jow Wirtley's Blog

All I had to do was update the bindings in the app.config of the client app and it all works now.

MikeScott8
A: 

Sorry for asking the obvious: Can you check that the string you are returning from the web service is longer than 8192 bytes?

Espo
yes it was longer and I had to update the config file, as mentioned in linked blog post, and that fixed it. thanks for the reply
MikeScott8
+4  A: 

Try this blog post here. You can the MaxStringContentLength property in the Binding configuration.

Darrel Miller
yes it was the solution, I had to update the config file, as mentioned in linked blog post, and that fixed it. thanks for the reply
MikeScott8
A: 

Sorry I was not clear but I did solve this, I just cant accept my own answer as the answer!

Just went over to uservoice and see it's been declined numerous times to allow people to accept thier own answer (even though it was mentioned on SO podcast that it should be used to post and answer questions to help others ~and yourself~ to find solutions later on)

MikeScott8
A: 

i think this is the best solution one can get i tried and solved my problem refer

http://mjeaton.net/blog/archive/2008/05/12/wrestling-with-wcf.aspx

anil