【发布时间】:2021-10-30 15:38:44
【问题描述】:
我有一个与 Postman 一起使用的 URL,它需要包含用户名和密码。此外,还有 0 伴随的 WSDL。但是,我无法弄清楚在 java 代码中调用它的正确方法。我的用户名和密码已经写了 XHTML 和 Java 来检索用户名和密码。谁能给我一些关于这个过程的指导?
我尝试了以下但没有运气,因为我需要为 APOD 添加一个 maven 依赖项。
// URL
URL url = new URL("URL");
// Open a connection
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// This line makes the request
InputStream responseStream = connection.getInputStream();
// Manually converting the response body InputStream to APOD using Jackson
ObjectMapper mapper = new ObjectMapper();
APOD apod = mapper.readValue(responseStream, APOD.class);
// Finally we have the response
System.out.println(apod.title);
【问题讨论】:
-
你还没有告诉我们问题是什么。
-
您尝试访问的 Web 服务的端点 url 是什么?
-
该 URL 仅生成一个会话 ID,用于进行第二个 Web 服务调用。
标签: java web-services wsdl2java