When calling a web service which returns an XML file of more than 100 MB of data, i am getting an exception.

  • Thread starter Thread starter Shailendra_G
  • Start date Start date
S

Shailendra_G

Guest
Hi,



I have an application which is written in C#. This calls a Java Web service.

When i call the web service, i get a string object in return. When the file size is more than 100 MB, sometimes i get an exception.

So it is not consistent all the times. Sometimes i get the data and sometimes exception.

Following is the code that calls the web service. I have captured the size of the file on the web service side and that is how i know that the file size is more than 100 MB.




public static object CallMethod(string method, Type t, Object O, params object[] parameters)
{
object retval = null;
try
{
retval = (object)t.InvokeMember(
method,
BindingFlags.InvokeMethod,
null /* Binder */,
O,
parameters /* args */);

}
catch (Exception ex)
{

}
return retval;
}



following is the exception that i get



9/15/2010 2:00:11 PM ==> Exception has been thrown by the target of an invocation.
9/15/2010 2:00:11 PM ==> Error on Calling Webservice:System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.set_Capacity(Int32 value)
at System.Xml.BufferBuilder.ToString()
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMyWebService.Read2_getReportDataResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer3.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at MyWebService.getReportData(String getReportData1)



Can someone please let me know if it is the issue with the way i am calling the web service or is it the issue with the network and how do i find out the problem.

Continue reading...
 
Back
Top