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

Getting Error "Transport error: 411 Error: Length Required" when trying to get Objects using Branded Cloudforce URL

We have a Salesforce connector for API version 26 as well as 28 for extracting the data using corresponding WSDL from a Salesforce Org. We are able to get objects and extract data for customer which does not use branded Cloudforce URL.

But We are facing issue when we try to extract the data from a Salesforce Org which has branded cloudforce URL.

We get Transport error: 411 Error: Length Required when trying get objects for user and when we try to extract the data.

Following is code snippet where we are getting this error(It gives above error when we call stub.describeGlobal(..)) :

stub = createStub();  
DescribeGlobal describeGlobal = new DescribeGlobal();
PackageVersionHeader packageVersionHeader = new PackageVersionHeader();
DescribeGlobalResponse dgrs = stub.describeGlobal(describeGlobal, sessionHeader, co, packageVersionHeader);

It fails with following Error from salesforce side:

Transport error: 411 Error: Length Required
at com.sforce.soap.partner.SforceServiceStub.describeGlobal(

Note: we are passing sessionHeader,CallOptions correctly.
Code Snippet for same:
Options options = stub._getServiceClient().getOptions();
String SFDCClientID = getBirstParameter(SFDC_CLIENT_ID);
if (SFDCClientID != null && SFDCClientID.trim().length() > 0)
co = new CallOptions();

SforceServiceStub stub = new SforceServiceStub(stubServerUrl);
Options options = stub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.TRUE);
options.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Constants.VALUE_TRUE);

Also Note that we use SOAP API and use WSDL to provide us the default login URL for to connect and upon connect, we use the URL return by the Salesforce for data extraction.

Can someone suggest us on how we can fix this issue.
To add more details to this problem, we are able to work with soap webservices if we do not use compression (gzip) AND turn off http chunk:

options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.FALSE);
options.setProperty(HTTPConstants.MC_GZIP_REQUEST, Boolean.FALSE);

Can someone help us understand why would this be a problem only for branded cloudforce url only?
Business ObjectsBusiness Objects
Did you get an answer to this?

I have exactly this problem with the salesforce adapter, and so far cannot get the web service working any help would be awesome, thanks.
It's pretty bad that server that supports branded cloudforce url does not use compression. We did not hear anything from Salesforce about this. But we had to code hack by catching transport error and retrying with compression off. Ugly but works.
Satish PrajapatSatish Prajapat

Hello All,

Please refer the below code:

HttpRequest req = new HttpRequest();
req.setEndpoint('Your url which you want to hit.');
req.setBody('Body');//When I added this tag than I removed the 'read time out error.'
HttpResponse response = new Http().send(req);

Enjoy My Dost....!!!!!!
@mpandit1.3971508409854524E12 How you make compression off? Thanks!