function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OpenbravoOpenbravo 

System.CalloutException: Unexpected end of file from server

Hi,

we've been experiencing an issue with a particular web service request which returns the following error:

13:29:00.521 (521402141)|CALLOUT_REQUEST|[224]|System.HttpRequest[Endpoint=https://ourwebpage/org.salesforceintegration.PtrSummary, Method=GET]
13:31:05.491 (125491869678)|EXCEPTION_THROWN|[224]|System.CalloutException: Unexpected end of file from server

The webservice works fine from a browser and returns a well-formed XML. This started happening overnight without doing any changes on our side so I am wondering if it could be related to any new limit or policy by Salesforce?

For the record, it is a rather large XML file (245kb).

Regards
R_jewraniR_jewrani
Hi Openbravo
Can you paste your code if possible so that it will be easier to debug for members
OpenbravoOpenbravo
Sure, here it goes:
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://ourwebpage/org.salesforceintegration.PtrSummary');
req.setMethod('GET');
req.setTimeout(120000);
Blob headerValue = Blob.valueOf(user + ':' + pwd);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
HTTPResponse res = new HttpResponse();
res = http.send(req);
response = res.getBody();
statusCode = res.getStatusCode();

Regards