This my code someone say were i missed it

OAuthRsaSha1Signer rsaSigner = new OAuthRsaSha1Signer();
            com.google.gdata.client.authn.oauth.OAuthParameters params = new com.google.gdata.client.authn.oauth.OAuthParameters();
            params.setOAuthConsumerKey(oauthconsumerkey);
            params.setOAuthNonce(Util.getNonce());
            params.setOAuthTimestamp(Util.getTimestamp());
            params.setOAuthSignatureMethod("RSA-SHA1");
            params.setOAuthType(com.google.gdata.client.authn.oauth.OAuthParameters.OAuthType.TWO_LEGGED_OAUTH);
            params.addCustomBaseParameter("oauth_version", "1.0");
            rsaSigner.setPrivateKey(privKey);
            String method = "GET";
            if (body != null && body.length() > 0) {
                method = "POST";
                MessageDigest digest = MessageDigest.getInstance("SHA-1");
                digest.reset();
                byte[] hash = digest.digest(body.getBytes("UTF-8"));
                String encodedHash = Base64.encode(hash);
                params.addCustomBaseParameter("oauth_body_hash", encodedHash);
            }
            String baseString = OAuthUtil.getSignatureBaseString(httpsURL, method, params.getBaseParameters());
            String signature = rsaSigner.getSignature(baseString, params);
            params.addCustomBaseParameter("oauth_signature", signature);

            URL url = new URL(httpsURL);
            con = (HttpsURLConnection) url.openConnection();
            con.setRequestMethod(method);
            con.setSSLSocketFactory((SSLSocketFactory) SSLSocketFactory.getDefault());
            con.setDoOutput(true);
            con.setDoInput(true);
            con.addRequestProperty("Authorization", buildAuthHeaderString(params));
            System.out.println(buildAuthHeaderString(params));

            if (body != null && body.length() > 0) {
                con.addRequestProperty("content-type", "application/xml; charset=UTF-8");
                con.addRequestProperty("content-length", Integer.toString(body.length()));
            }
            con.connect();

            if (body != null && body.length() > 0) {
                CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
                OutputStreamWriter request = new OutputStreamWriter(con.getOutputStream(), encoder);
                request.append(body);
                request.flush();
                request.close();
            }

Well, 400 means your request is bad. Have you traced your POST and taken a look at the actual request that is sent? Using Charles Proxy, you can easily see what request are being sent, and then see where the problem is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.