Error 400 Bad Request using CardDav with iCal4j with Zimbra

549 views Asked by At

I'm trying to download the vcard list from my zimbra account using iCal4j.

I tried with this code. It correctly fetches the collections but it doesn't download any vCard.

If i debug the getCollections method, i can see a HTTP/1.1 400 Bad Request error.

Can anyone help ?

Regards

Stefano

CardDavStore kerioStore = new CardDavStore("//MacTI/MKS2Exchange", new URL("https://xxx.xxx.xxx"), PathResolver.ZIMBRA);
kerioStore.connect("[email protected]", "supersecret".toCharArray());
for (CardDavCollection collection: kerioStore.getCollections()) {
    for (VCard card: collection.getComponents()) {
        System.out.println(card.toString());
    }
}

This is the HTTP request trace:

DEBUG [main] HttpMethodBase.shouldCloseConnection(1024) | Resorting to protocol version default close connection policy
DEBUG [main] HttpMethodBase.shouldCloseConnection(1028) | Should NOT close connection, using HTTP/1.1
DEBUG [main] HttpConnection.releaseConnection(1178) | Releasing connection back to connection manager.
DEBUG [main] header.wire(70) | >> "REPORT /dav/<myemailaccount>/TestCardDav/ HTTP/1.1[\r][\n]"
DEBUG [main] HttpMethodBase.addHostRequestHeader(1352) | Adding Host request header
DEBUG [main] header.wire(70) | >> "Depth: 1[\r][\n]"
DEBUG [main] header.wire(70) | >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
DEBUG [main] header.wire(70) | >> "Host: xxx.xxx.xxx[\r][\n]"
DEBUG [main] header.wire(70) | >> "Content-Length: 199[\r][\n]"
DEBUG [main] header.wire(70) | >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
DEBUG [main] header.wire(70) | >> "[\r][\n]"
DEBUG [main] content.wire(84) | >> "<?xml version="1.0" encoding="UTF-8" standalone="no"?><C:addressbook-query xmlns:C="urn:ietf:params:xml:ns:carddav"><D:prop xmlns:D="DAV:"><C:address-data/><D:getetag/></D:prop></C:addressbook-query>"
DEBUG [main] EntityEnclosingMethod.writeRequestBody(508) | Request body sent
DEBUG [main] header.wire(70) | << "HTTP/1.1 401 must authenticate[\r][\n]"
DEBUG [main] header.wire(70) | << "HTTP/1.1 401 must authenticate[\r][\n]"
DEBUG [main] header.wire(70) | << "Date: Wed, 04 Dec 2013 22:16:48 GMT[\r][\n]"
DEBUG [main] header.wire(70) | << "WWW-Authenticate: BASIC realm="Zimbra"[\r][\n]"
DEBUG [main] header.wire(70) | << "Content-Length: 0[\r][\n]"
DEBUG [main] header.wire(70) | << "[\r][\n]"
DEBUG [main] HttpMethodDirector.isAuthenticationNeeded(843) | Authorization required
DEBUG [main] AuthChallengeProcessor.selectAuthScheme(90) | Supported authentication schemes in the order of preference: [Digest, Basic]
DEBUG [main] AuthChallengeProcessor.selectAuthScheme(111) | Challenge for Digest authentication scheme not available
INFO [main] AuthChallengeProcessor.selectAuthScheme(101) | Basic authentication scheme selected
DEBUG [main] AuthChallengeProcessor.processChallenge(155) | Using authentication scheme: basic
DEBUG [main] AuthChallengeProcessor.processChallenge(163) | Authorization challenge processed
DEBUG [main] HttpMethodDirector.processWWWAuthChallenge(714) | Authentication scope: BASIC 'Zimbra'@mail.zcsmail.eu:443
DEBUG [main] HttpMethodDirector.executeMethod(194) | Retry authentication
DEBUG [main] HttpMethodBase.shouldCloseConnection(1024) | Resorting to protocol version default close connection policy
DEBUG [main] HttpMethodBase.shouldCloseConnection(1028) | Should NOT close connection, using HTTP/1.1
DEBUG [main] HttpConnection.releaseConnection(1176) | Connection is locked.  Call to releaseConnection() ignored.
DEBUG [main] HttpMethodDirector.authenticateHost(278) | Authenticating with BASIC 'Zimbra'@xxx.xxx.xxx:443
DEBUG [main] HttpMethodParams.getCredentialCharset(384) | Credential charset not configured, using HTTP element charset
DEBUG [main] header.wire(70) | >> "REPORT /dav/<myemailaccount>/TestCardDav/ HTTP/1.1[\r][\n]"
DEBUG [main] HttpMethodBase.addHostRequestHeader(1352) | Adding Host request header
DEBUG [main] header.wire(70) | >> "Depth: 1[\r][\n]"
DEBUG [main] header.wire(70) | >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
DEBUG [main] header.wire(70) | >> "Content-Length: 199[\r][\n]"
DEBUG [main] header.wire(70) | >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
DEBUG [main] header.wire(70) | >> "Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==[\r][\n]"
DEBUG [main] header.wire(70) | >> "Host: xxx.xxx.xxx[\r][\n]"
DEBUG [main] header.wire(70) | >> "[\r][\n]"
DEBUG [main] content.wire(84) | >> "<?xml version="1.0" encoding="UTF-8" standalone="no"?><C:addressbook-query xmlns:C="urn:ietf:params:xml:ns:carddav"><D:prop xmlns:D="DAV:"><C:address-data/><D:getetag/></D:prop></C:addressbook-query>"
DEBUG [main] EntityEnclosingMethod.writeRequestBody(508) | Request body sent
DEBUG [main] header.wire(70) | << "HTTP/1.1 400 Bad Request[\r][\n]"
DEBUG [main] header.wire(70) | << "HTTP/1.1 400 Bad Request[\r][\n]"
DEBUG [main] header.wire(70) | << "Date: Wed, 04 Dec 2013 22:16:49 GMT[\r][\n]"
DEBUG [main] header.wire(70) | << "Content-Length: 0[\r][\n]"
DEBUG [main] header.wire(70) | << "[\r][\n]"
0

There are 0 answers