如何更改 Web 服务上的端点
我正在努力调用网络服务客户端。目前,我正在连接测试环境。为了连接到生产环境,我必须连接到生产环境。我连接测试环境的流程如下。
- 将 WSDL 复制到本地目录
- 运行
wsdl2java
以生成域对象和其他带注释的类。有一个带有@WebServiceClient
和一对带有@WebService
- 从那里我只是使用生成的对象来调用这些类。
我不明白的是,一旦我们进入生产环境,我将在哪里更改服务调用的端点。
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.
- Copy WSDL to local directory
- Run
wsdl2java
to generate domain objects and other annotated classes. There is one with@WebServiceClient
and a couple with@WebService
- 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技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另外,如果您检查 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.
我相信 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.