HTTP 响应代码 400 向 HTTPS 查询发送 GET 请求 API

HTTP response code 400 sending GET Request to HTTPS Query API

我正在尝试使用 SES HTTPS 查询 API 发送电子邮件。我有一个 java 方法向 Amazon SES 端点发送 GET 请求,我正在尝试使用 SES 发送电子邮件并捕获结果。

代码:

public static String SendElasticEmail(String timeConv,String action,String source, String destinationAddr, String subject, String body) {
    try {
        System.out.println("date :    "+timeConv);

        System.out.println("In Sending Mail Method......!!!!!");

        //Construct the data
        String data = "Action=" + URLEncoder.encode(action, "UTF-8");
        data += "&Source=" + URLEncoder.encode(source, "UTF-8");
        data += "&Destination.ToAddresses.member.1=" + URLEncoder.encode(destinationAddr, "UTF-8");
        data += "&Message.Subject.Data=" + URLEncoder.encode(subject, "UTF-8");
        data += "&Message.Body.Text.Data=" + URLEncoder.encode(body, "UTF-8");

        //Send data
        System.out.println("https://email.us-east-1.amazonaws.com?"+data);
        URL url = new URL("https://email.us-east-1.amazonaws.com?"+data);
        //URLConnection conn = url.openConnection();

        HttpsURLConnection con = (HttpsURLConnection) url.openConnection();

        con.setRequestMethod("GET");

        con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        con.setRequestProperty("x-amz-date" , timeConv);
        con.setRequestProperty("Content-Length", ""+data.toString().length());

        con.setRequestProperty("X-Amzn-Authorization" , authHeader);

        int responseCode = ((HttpsURLConnection) con).getResponseCode();
        String responseMessage = ((HttpsURLConnection) con).getResponseMessage();

        System.out.println("\nSending 'GET' request to URL : " + url);
        System.out.println("Response Code : " + responseCode);
        //System.out.println("Response Message : " + responseMessage);

        InputStream stream = con.getInputStream();
        InputStreamReader isReader = new InputStreamReader(stream ); 

        System.out.println("hgfhfhfhgfgfghfgh");
        BufferedReader br = new BufferedReader(isReader);
        String result = "";
        String line;
        while ((line = br.readLine()) != null) {
            result+= line;
        }
        System.out.println(result);
        br.close();
        con.disconnect();
    }

    catch(Exception e) {
        e.printStackTrace();
    }
    return subject;
}

我已经正确计算了签名,因为从邮递员客户端点击时得到 200 响应。

URL url = new URL("https://email.us-east-1.amazonaws.com?"+data);

你漏掉了问号前的 '/'。应该是

URL url = new URL("https://email.us-east-1.amazonaws.com/?"+data);