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
bharath11rbharath11r 

Not able to connect to webservice status 302 error

I am trying to connect to carrier 411 webservice to pull some data but keep getting the below error everytime I call.  If i use the same soap request in SOAP UI tool its giving me soap response.  Could anyone please shed some light into it.

 

 

11:54:28.084 (84661000)|CALLOUT_REQUEST|[56]|System.HttpRequest[Endpoint=http://webservices.carrier411.com/wsLogin.cfc, Method=POST]
11:54:28.418 (418009000)|CALLOUT_RESPONSE|[56]|System.HttpResponse[Status=Moved Temporarily, StatusCode=302]

 

 

Below is the soap request

 

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <login xmlns="http://webservices.carrier411.com">
      <param1>user</param1>
      <param2>password</param2>
    </login>
  </soap:Body>
</soap:Envelope>

 

this is how i am calling the service,,,

 public static string getResponse(String request,String URL)
  {
    try{
      Http h = new Http();
      HttpRequest req = new HttpRequest();
       req.setHeader('Content-Type','text/xml;charset=utf-8');
      req.setMethod('POST');
      req.setEndpoint(URL);
      req.setBody(request);
      req.setTimeout(2000);
      System.Debug('HTTP Request is ' + req);
      HttpResponse res = h.send(req);
      
      System.Debug('HTTP Resonse is ' + res);
      return res.getBody();
    }
    catch(Exception ex) {
        throw ex;
        }
  }
 

This is the webservice  I am trying to call...I am not sure whether  i am missing anything in the header part....

webservices.carrier411.com/wsLogin.cfc?wsdl

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

It looks like you're not sending the SOAPAction http header, you'll need to add that. (the wsdl will contain the expected value for it).

All Answers

SuperfellSuperfell

It looks like you're not sending the SOAPAction http header, you'll need to add that. (the wsdl will contain the expected value for it).

This was selected as the best answer
bharath11rbharath11r

Wow you are amazing...man U made my day....Thanks for the prompt response....Its so easy i missed it..


SimonF wrote:

It looks like you're not sending the SOAPAction http header, you'll need to add that. (the wsdl will contain the expected value for it).


 

Vishal Dube 1Vishal Dube 1
This is still helpful. thanks for posting