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
dcarmen66dcarmen66 

Web Service Callout - External server did not return any content

I am trying to use a web service to connect to an external site and I keep on getting:

 

System.CalloutException: IO Exception: External server did not return any content

 

I was able to successfully import their wsdl and I was trying to do a simple ping operation. I tried the connection in soapUI and it was successful and returned a response.

 

One question I had was if Salesforce handles the <s:any /> complex type correctly. Their wsdl has:

 

      <s:element name="PingResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="PingResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

and the code it generates is:

 

    public class PingResult_element {
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class PingResponse_element {
        public seniorhousingWeb.PingResult_element PingResult;
        private String[] PingResult_type_info = new String[]{'PingResult','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{'PingResult'};
    }

Any help is appreciated!!

Vinita_SFDCVinita_SFDC

Hello,

 

How are you sending your login credentials, is that a HTTP Authentication header? If yes, then HTTP Authentication header is not supported by salesforce.com web services. You need to call the login method to get a sessionId (or get a sessionId through one of the other methods) and set the session soap header to the relevant value.

 

IF not, then try resetting your password. Also verify whether your external server got the callout, and whether it returned any content.

dcarmen66dcarmen66

Hi, thank-you for your response. I'm definitely not an expert on these but I have done a few and this one seems to be in line with others I have done except for the use of the <s:any /> in the wsdl. The following are the Apex methods that were generated:

 

    public class Ping_element {
        public String DbUserName;
        public String DbPassword;
        public String DbName;
        public String Server;
        public String Platform;
        private String[] DbUserName_type_info = new String[]{'DbUserName','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] DbPassword_type_info = new String[]{'DbPassword','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] DbName_type_info = new String[]{'DbName','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] Server_type_info = new String[]{'Server','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] Platform_type_info = new String[]{'Platform','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{'DbUserName','DbPassword','DbName','Server','Platform'};
    }

 

        public seniorhousingWeb.PingResult_element Ping(String DbUserName,String DbPassword,String DbName,String Server,String Platform) {
            seniorhousingWeb.Ping_element request_x = new seniorhousingWeb.Ping_element();
            seniorhousingWeb.PingResponse_element response_x;
            request_x.DbUserName = DbUserName;
            request_x.DbPassword = DbPassword;
            request_x.DbName = DbName;
            request_x.Server = Server;
            request_x.Platform = Platform;
            Map<String, seniorhousingWeb.PingResponse_element> response_map_x = new Map<String, seniorhousingWeb.PingResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'YSI.Portal.SeniorHousing.WebServices/Ping',
              'YSI.Portal.SeniorHousing.WebServices',
              'Ping',
              'YSI.Portal.SeniorHousing.WebServices',
              'PingResponse',
              'seniorhousingWeb.PingResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.PingResult;
 

Lakshmi_lb14447Lakshmi_lb14447
Though it is an old post, I though this info might help someone.

Please make sure that the SOAP message built in the callout conforms to the sample SOAP message given by your service provider. If sample is not available from the service provider compare it with the working SoapUI request message.
Apex callout by default inserts empty SOAP header "<env:Header/>", the issue can be as simple as the callout SOAP message containing this empty header which the server does not expect.
ramasubramanian.arramasubramanian.ar
I am facing the similar issue, How should I remove "env: Header" from the request?