現在、資格情報とXMLをTextPane
またはファイルから選択するためにシステムに取り組んでいますが、FileChooser
でそのパスを取得します。私の質問は、誰かがHttpsUrlConnection
の設定方法を知っているかどうかです。 getEncodingFromPartner(/ 0/1) ActDelivery_HTTP.Inbound:receiveXML(/ 0/0/0) UTF-Iは、そのが.setRequestProperty
または.addRequestProperty
によって行われますが、サーバーは、このエラーにJava HttpsURLConnectionの設定
ActDelivery_HTTP.Utilsを投げていることを理解し8
私は多くの研究をしましたが、私はJavaではそれほど良くありません。だから誰かがHttpsUrlConnection
の設定を説明できるかどうか尋ねているのです。
try {
Authenticator.setDefault (new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication (textUser.getText(), textPass.getText().toCharArray());
}
});
URL myurl = new URL(httpsURL);
HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-length", URLEncoder.encode(textXML.getText(), "UTF-8"));
con.setRequestProperty("Content-Type","text/xml; charset=UTF-8");
con.setRequestProperty("Https-Agent", "");
con.setRequestProperty("Content", URLEncoder.encode(textXML.getText(), "UTF-8"));
con.setRequestProperty("Dest-Port", "443"); // I'm not sure how to add the xml as request
con.setDoOutput(true); // out of a text box or just the file at all
con.setDoInput(true);
DataOutputStream output = new DataOutputStream(con.getOutputStream());
output.writeBytes(textXML.getText());
output.close();
DataInputStream input = new DataInputStream(con.getInputStream());
for(int c = input.read(); c != -1; c = input.read())
System.out.print((char)c);
input.close();
System.out.println("Resp Code:"+con .getResponseCode());
System.out.println("Resp Message:"+ con .getResponseMessage());
Authenticatorは、Webサイトに組み込まれているBasic Authentication Systemに資格情報を提供するために使用されます。それはあなたが欲しいものですか? または、レスポンスでプロパティとしてクレデンシャルを送信したいだけですか? –