• Kujambal Rajendran 23
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 8
    Replies

I'm facing the API 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.
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:
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