如何更改 Web 服务上的端点

发布于 2024-12-02 12:34:04 字数 295 浏览 1 评论 0原文

我正在努力调用网络服务客户端。目前,我正在连接测试环境。为了连接到生产环境,我必须连接到生产环境。我连接测试环境的流程如下。

  1. 将 WSDL 复制到本地目录
  2. 运行 wsdl2java 以生成域对象和其他带注释的类。有一个带有 @WebServiceClient 和一对带有 @WebService
  3. 从那里我只是使用生成的对象来调用这些类。

我不明白的是,一旦我们进入生产环境,我将在哪里更改服务调用的端点。

I am working on calling web service client. Currently, I am connecting to the test environment. In order to connect to production environment I have to connect to production environment. My process in terms of connecting to the test environment is as follows.

  1. Copy WSDL to local directory
  2. Run wsdl2java to generate domain objects and other annotated classes. There is one with @WebServiceClient and a couple with @WebService
  3. From there I am just using the generated objects to call these classes.

What I don't get is where I would change the endpoints for the service call once we go to production environment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤凫 2024-12-09 12:34:05

另外,如果您检查 Service 构造函数,在我生成的代码中,其中一个构造函数将 URL 作为参数。

Also, if you check the Service constructor, on the generated code I have, one of the constructors take in a URL as it's arguments.

如何视而不见 2024-12-09 12:34:04

我相信 wsdl2Java 使用 setEndpointAddress() 生成一个代理类,您可以在其中更改目标 URL。此方法应位于生成的 ServiceLocator 中。

I believe wsdl2Java generate a Proxy class with setEndpointAddress() where you could change the target URL. This method should be located in the generated ServiceLocator.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文