Skip to main content
Richard Johnson ha fatto una domanda in #Apex
I am trying to send a Http message to a URL. SOunds simple. If I try against URL (a) it works if a Itryt against another URL it doesn't. It has been confirmed to me that both URLs are valid. Is there anyway I can confirm the message leaves Salesforce?

This code works:

HttpRequest httpRequest = new HttpRequest();

HttpRequest.setTimeout(600 * 100); // 60 seconds

httpRequest.setEndpoint('https://gb1edvwmgaapp01.meggittplcx.com/rest/meggitQuoteIntegration.services.smoketest');

httpRequest.setMethod('GET');

httpRequest.setHeader('Content-Type', 'application/json');  

httpRequest.setHeader('Authorization', 'Basic bWVnZ2l0dF9zZmRjX2NwcV90ZXN0OkNwcV9TZmRjLTE=');            

Http http = new Http();

try {

    HttpResponse httpResponse = http.send(httpRequest);

    System.debug('Response From WM is:'+httpResponse.getBody());

}catch(Exception e)

{

    System.debug('Error Message:'+e.getMessage());

}

System log gives: 'Response form WM is:'

This code timesout:

HttpRequest httpRequest = new HttpRequest();

HttpRequest.setTimeout(600 * 100); // 60 seconds

httpRequest.setEndpoint('https://gb1epvwmgaapp01.meggittplcx.com/rest/meggitQuoteIntegration.services.smoketest');

httpRequest.setMethod('GET');

httpRequest.setHeader('Content-Type', 'application/json');  

httpRequest.setHeader('Authorization', 'Basic bWVnZ2l0dF9zZmRjX2NwcV90ZXN0OkNwcV9TZmRjLTE=');            

Http http = new Http();

try {

    HttpResponse httpResponse = http.send(httpRequest);

    System.debug('Response From WM is:'+httpResponse.getBody());

}catch(Exception e)

{

    System.debug('Error Message:'+e.getMessage());

}

The System log gives: 'Error Message:Unexpected end of file from server

The difference is in the URL, where character 5 'd' in gb1edvwmgaapp is changed to a 'p' to get  gb1epvwmgaapp
2 risposte
  1. 15 mar 2018, 09:48
    @Raj V - Thank you for the suggestions, but the problem we are facing is getting any response back.

    The working link returns a message as expected, bu the non-working link just times out.

    The receiving end denies seeing any traffic, so we are trying to initially establish how we can confirm the message actually leaves SFDC.
0/9000