tahseen / amazon-cloudsearch-client-java

Amazon CloudSearch Client for Document Service and Searching
18 stars 22 forks source link

The Content-Type header is missing. #3

Closed rblazquez closed 9 years ago

rblazquez commented 9 years ago

Hello,

I am trying this library but i get

" aws.services.cloudsearchv2.AmazonCloudSearchRequestException: The Content-Type header is missing"

when simply:

    AmazonCloudSearchAddRequest addRequest = new AmazonCloudSearchAddRequest();
    addRequest.id = "acb123";
    addRequest.version = 1;
    amazonCloudSearchClient.addDocument(addRequest);

Does the library works?

tahseen commented 9 years ago

What version of AWS sdk you are using?

tahseen commented 9 years ago

Currently this library is in production with 1.9.13 version of AWS SDK.

rblazquez commented 9 years ago

i'll check that

Thank you.

rblazquez commented 9 years ago

I've packaged your libreary as it is ... with maven dependency on AWS SDK 1.9.13

Then i created a dummy project depending on it

    AWSCredentials awsCredentials = new BasicAWSCredentials(
            awsAccessKey,
            awsSecretKey);
    ;
    AmazonCloudSearchClient client = new AmazonCloudSearchClient(awsCredentials);
    client.setSearchEndpoint(searchEndpoint);
    client.setDocumentEndpoint(documentEndpoint);

    AmazonCloudSearchAddRequest addRequest = new AmazonCloudSearchAddRequest();
    addRequest.id = "acb123";
    addRequest.version = 1;
    addRequest.addField("text_field", "Some Value");
    addRequest.addField("int_field", 123);

    try {
        client.addDocument(addRequest);
        Thread.sleep(2000);
    } catch (AmazonCloudSearchRequestException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (AmazonCloudSearchInternalServerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }   

got same problem "The Content-Type header is missing"

Also i seen that documentation is outdated since the

client.setSearchDomain(searchEndpoint); client.setDocumentDomain(documentEndpoint);

methods are called now setSearchEndpoint and setDocumentEndpoint (Thats why i asked about the status of the project, although i understand is normal since mantain documentation is hard)

Could the AWS SDK in my machine affect even when you has the version hardcoded in the maven dependecy?

tahseen commented 9 years ago

I will try to look into this tonight