Что нужно добавить к запросу, чтобы решить эту проблему?
public String sendRequest() throws Exception{
StringBuilder builder = new StringBuilder();
String request ;
request = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sup=\"http://support.xxxxxxxx.ru\">\n" +
" <soapenv:Header/>\n" +
" <soapenv:Body>\n" +
" <sup:DSPersonFindByIDReq>\n" +
" <!--Optional:-->\n" +
" <sup:CodePasspDepartment></sup:CodePasspDepartment>\n" +
" <!--Optional:-->\n" +
" <sup:DetailFlag></sup:DetailFlag>\n" +
" <!--Optional:-->\n" +
" <sup:PersonID>10000031788</sup:PersonID>\n" +
" </sup:DSPersonFindByIDReq>\n" +
" </soapenv:Body>\n" +
"</soapenv:Envelope>";
try {
URL obj = new URL(Config.getProperty("url_crmws"));
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
String encoding = Base64.getEncoder().encodeToString((
Config.getProperty("ws_login")+":"+Config.getProperty("ws_password")).getBytes("UTF-8"));
//подготовка
con.setRequestMethod("POST"); //передавать постом
con.setDoInput(true); //передача запроса на сервер
con.setDoOutput(true); //прием ответа
con.setUseCaches(false); //без кэширования
con.addRequestProperty("Content-Type", "application/xml; charset=utf-8"); //кодировка
con.addRequestProperty("Cache-Control", "no-cache");
con.addRequestProperty("Cache-Control", "no-store");
con.setRequestProperty("Content-Length", //con.setRequestProperty("Authorization", "Basic " + encoding);
//отправка
OutputStream os = con.getOutputStream();
os.write(request.getBytes());
os.flush();
os.close();
}
Свежие комментарии