+ Start a Discussion
Amish RanjitAmish Ranjit 

Fedex Integartion !

I have been trying to use NON SOAP method for Fedex- Salesforce integration. I am using  Developer console to pass the sample value. While running the sample code, I am getting "Read Time Out" exception.  I had also set time to 2 minute and  still showing same exception. Below is my sample code,

HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
String xml = '<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-              ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="http://fedex.com/ws/rate/v13".....................................'
req.setEndpoint('https://wsbeta.fedex.com:443/web-services');
req.setMethod('POST');
req.setTimeout(120000);
system.debug(req);
req.setHeader('Referrer', 'Cloudygen');
req.setHeader('Host', 'wsbeta.fedex.com');
req.setHeader('Accept', 'image/gif, image/jpeg,image/pjpeg, text/plain, text/html, */*');
req.setHeader('Content-Type', 'image/gif');
req.setHeader('Content-Length',String.valueOf(xml.length()));
system.debug(req);
res = http.send(req);
system.debug(res);

I would be glad if someone could help me with this. I would also appreciate if anyone could provide me with different approach for FEDEX integration.
Jyosi jyosiJyosi jyosi
Hello Amish,
Two possible thing may be happening .
1) Fed server is not up-end running.
2) Check your whitelist IP,the connection is droping .


Thanks,

Reagards,
Ashok N
 
VineetKumarVineetKumar
Can you check your federation service as to how much time it is taking to exxecute it.
  • If the server was not running, it would have failed at the hanshaking itlself. some callout exception.
  • Whitelisting would also have failed at handshake.
What I suggest you is to get a 3rd party tool (like SOAP UI), try hitting the fedex service and see if you are still facing the issue, and the time it is taking to return you the reponse. If it is getting timed out in the 3rd party tool then the fedex service would have to be optimized.
Also, set your debug log for this and see how time your class is taking to execute after you receive the response.

Let me know with your findings.