OpenNTF/SocialSDK

Request to url returned an error response 411:Length Required HTTP/1.1 411 Length Required

Opened this issue · 1 comments

Hi,

I am trying to update files via the methods updateFile and updateCommunityFile provided by the FileSerivce. However, both methods throw the same error:

java.lang.RuntimeException: com.ibm.sbt.services.client.ClientServicesException: Request to url returned an error response 411:Length Required HTTP/1.1 411 Length Required [Server: AkamaiGHost, Mime-Version: 1.0, Content-Type: text/html, Content-Length: 221, Expires: Mon, 06 Jun 2016 09:17:32 GMT, Date: Mon, 06 Jun 2016 09:17:32 GMT, Connection: close]

I tried fixing it by adding the Content-Length myself:

final FileService service = new FileService(connection.getEndpoint()) {
@Override
public Response updateData(final String serviceUrl, final Map<String, String> parameters, final Map<String, String> headers, final Object content, final String nameParameterId) throws ClientServicesException
{
headers.put("Content-Length", length);
return super.updateData(serviceUrl, parameters, headers, content, nameParameterId);
}};

When using this, I get an error that says that Content-Length is defined twice.

Fixed it by adding the length tag to the content object instead of the header object in the method above. This is still an issue however.