-2
 String reqURL = baseUrl + data_oauth.get(PropLoad.getTestXmlData("URL"));
    Template template = new Template();
    String updatedUrl = template.getUpdatedURL(reqURL);

    Map<String, String> headers = Template.getRequestData(data_oauth,PropLoad.getTestXmlData("HEADER"));
    headers.entrySet().toString();

    String updatedAuthor = template.getAuthorizationHeader(headers, methodDesc);
    headers.put("Authorization", updatedAuthor);
    String xmlRequest = Template.generateStringFromResource(data_oauth,"xmlbody");
    Response response = webCredentials_rest.postCallWithHeaderAndBodyParamForXml(headers, xmlRequest, updatedUrl);

// 応答として Unmarshalled を取得しています。XML 本文を含む POST 要求を投稿するのを手伝ってもらえますか

4

1 に答える 1

0

次のように送信できます。

URL url = new URL(urlString);
URLConnection connenction = url.openConnection();
OutputStream output = connenction.getOutputStream();
InputStream input = new FileInputStream(xmlFile);
byte[] buffer = new byte[4096];
int len;
while ((len = input .read(buffer)) >= 0) {
    out.write(buffer, 0, len);
}
input .close();
output.close();

そして、次のような応答を読んでください。

StringBuilder stringBuilder = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(connenction.getInputStream()));
String readLine = reader.readLine();
while (readLine != null) {
    stringBuilder.append(readLine);
    readLine = br.readLine();
}
于 2017-02-15T07:56:33.423 に答える