Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Unrecognized content type:application/binary exception thrown when connecting via SSL behind a proxy #443

Description

@GoogleCodeExporter
Issue: Unrecognized content type:application/binary when connecting via SSL 
behind a proxy

I'm retrieving the spreadsheet entries using Java. Using the same source code, 
I was able to perform the action successfully when NOT connected behind a 
proxy. However, when I'm running the same application behind a proxy, I'm 
getting the following error:
com.google.gdata.util.ParseException: Unrecognized content 
type:application/binary

- Source Code Excerpt:
System.setProperty("https.proxyHost", "proxy");
System.setProperty("https.proxyPort", "port");
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new TrustManager[] { new X509TrustManager() {
  public X509Certificate[] getAcceptedIssuers() {
    return null;
  }

  public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
  }

  public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
  }
} }, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAM
E_VERIFIER);
SpreadsheetService service = new SpreadsheetService(applicationName);
service.setUserCredentials(username, password);
service.setContentType(ContentType.APPLICATION_XML);
service.useSsl();
service.getEntry(new URL(httpsUrlString), SpreadsheetEntry.class);

- Tracing through Google Code:
Service.getEntry(URL, Class<E>) -> .. -> Service.parseResponseData(GDataRequest 
req, Class<E> resultType) -> 
protected ClientInputProperties(GDataRequest req, Class<?> expectType)
        throws IOException, ServiceException {
      super(req);
      this.expectType = expectType;
      this.inputType = req.getResponseContentType(); //-- returns application/binary when connected behind a proxy
      init();
}

- What is the expected output? 
No exception is thrown when 'service.getEntry(new URL(httpsUrlString), 
SpreadsheetEntry.class);' is invoked when connected behind a proxy. 

- What do you see instead? 
com.google.gdata.util.ParseException: Unrecognized content 
type:application/binary

- What version of the product are you using? On what operating system?
com.google.gdata:core:1.47.1
com.google.api.client:google-api-data-spreadsheet-v3:1.0.10-alpha
Windows 7 Enterprise
Java JDK 1.7

Original issue reported on code.google.com by joy.mari...@gmail.com on 21 Jan 2014 at 9:38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions