Для SOAP-запроса есть конечная точка службы и файл xsd. Но нет wsdl файла. Как я могу сгенерировать запрос soap (xml-запрос как строку) вручную из этого и отправить его в конечную точку службы?
Я нашел аналогичный ответ на qaru.site/questions/58152/.... Но это для С# и.NET. Любая идея для Java будет высоко оценена.
Взгляните на [JAXB]: https://jaxb.java.net/ Это похоже на то, что вы просите. При необходимости он генерирует классы Java:
команда xjc является ключом к генерации
Вот пример из старого проекта моего подключения к веб-службе SharePoint. Он должен показать вам все основы, которые вам нужны.
try {
URL sharepoint = new URL("http://server.com/_vti_bin/Lists.asmx");
URLConnection sharepoint_connection = sharepoint.openConnection();
String body = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
" <soap:Body>" +
" </soap:Body>" +
"</soap:Envelope>";
System.out.println("~~~~~ Roadmap: " + body);
sharepoint_connection.setRequestProperty("Man", "POST /_vti_bin/Lists.asmx HTTP/1.1");
sharepoint_connection.setRequestProperty("Host", "server.com");
sharepoint_connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
sharepoint_connection.setRequestProperty("Content-Length", Integer.toString(body.length()));
sharepoint_connection.setRequestProperty("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems");
// Write request body to SharePoint
sharepoint_connection.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(sharepoint_connection.getOutputStream());
writer.write(body);
writer.close();
//sharepoint_connection.connect();
// Read result from SharePoint
BufferedReader reader = new BufferedReader(new InputStreamReader(sharepoint_connection.getInputStream()));
String inputLine;
while ((inputLine = reader.readLine()) != null)
xmltext += inputLine;
reader.close();
} catch (MalformedURLException e) { // new URL() failed
} catch (IOException e) { // openConnection() failed
}