You need to sign in to do that
Don't have an account?
SFDC coder
Error:Read timeout Exception during apex callouts
Hi all,
I have an apex callouts class taht invokes an external webservice.We have been using the SOAP API.
So i have imported the wsdl in salesforce and trying to invoke the autogenerated apex class.
However i get an error as:Read timeout Exception
Then i try to set the timeout as under and then invoke the webservice as below:
After executing the above code i get the below error:
*** ErrorSystem.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Server Error faultcode=SOAP:Server faultactor=
Can anyone please help?
Thanks
I have an apex callouts class taht invokes an external webservice.We have been using the SOAP API.
So i have imported the wsdl in salesforce and trying to invoke the autogenerated apex class.
However i get an error as:Read timeout Exception
Then i try to set the timeout as under and then invoke the webservice as below:
public class OrderCallOuts { @future(callout=true) public static void sendOrders(String orderId) { try { //creating stub SfdcDirectordersinbound.MIOS_SFDC_DIRECT_ORDERPort createOrder=new SfdcDirectordersinbound.MIOS_SFDC_DIRECT_ORDERPort(); //declaring the response element String callOutResponse=''; // providing the credentials and setting the header createOrder.inputHttpHeaders_x=new Map<String,String>(); String username = 'salerep1'; String password = 'Pass_1235'; Blob headerValue = Blob.valueOf(username+':'+password); String authorizationHeader = 'Basic ' +EncodingUtil.base64Encode(headerValue); createOrder.inputHttpHeaders_x.put('Authorization',authorizationHeader); //setting the timeout createOrder.timeout_x=120000; //Invoking the webservice to send orders from Salesforce callOutResponse=createOrder.MIOS_SFDC_DIRECT_ORDER(myOrder.CreatedBy.name,myOrder.LastModifiedBy.name); System.debug('Response from SAP system:'+callOutResponse); } catch(Exception ex) { System.debug('*** Error'+ex); } } }
After executing the above code i get the below error:
*** ErrorSystem.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Server Error faultcode=SOAP:Server faultactor=
Can anyone please help?
Thanks
Hi,
Since you set the maximum time out, salesforce will wait 120K milli seconds for the result to be returned by the service that you were consuming. Since that service is not able to return in time, you were being timed out. This has nothing to do with Salesforce side service rather i would recommend checking with the person who published the service to see if he can imporve his codes performance so that the output will be returned before the timeout happens.
I have been through this issue before mainly with .net services which we consumed, their queries/store procs were taking too long to be run, after too much back and forth, the developer for that .net service accepted and tweaked his queries which improved the response time and it never got errored out later that.
Hope this helps:
Thanks,
balaji
All Answers
Hi,
Since you set the maximum time out, salesforce will wait 120K milli seconds for the result to be returned by the service that you were consuming. Since that service is not able to return in time, you were being timed out. This has nothing to do with Salesforce side service rather i would recommend checking with the person who published the service to see if he can imporve his codes performance so that the output will be returned before the timeout happens.
I have been through this issue before mainly with .net services which we consumed, their queries/store procs were taking too long to be run, after too much back and forth, the developer for that .net service accepted and tweaked his queries which improved the response time and it never got errored out later that.
Hope this helps:
Thanks,
balaji
Please refer the below code:
Enjoy my DOST...!!!!!
Hi,
I'm facing the same issue and I tried hitting the end-point from Postman and its working fine but when I try hitting the same endpoint from Salesforce using Apex then it throws an exception for "Read Time out".
Please help me in getting this fixed.
Thanks
I'm facing the same issue and I tried hitting the end-point from Postman and browser and its working fine but when I try hitting the same endpoint from Salesforce using Apex and HTTP callout in flow, then it throws an exception for "Read Time out". I have set the maximum timeout as 120000 and set the body also. Appreciate your quick response in advance.