如何更改 <wsdlsoap:address location="">在运行时 [英] How can I change <wsdlsoap:address location=""> at runtime

查看:65
本文介绍了如何更改 <wsdlsoap:address location="">在运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Java 和 Axis 来开发我的网站和 WebService,但我遇到了一个问题:

I use Java and Axis to develop my website and WebService and I hava a problem:

我有 1 个 WS 模块,并且已将其插入一些在不同服务器上运行的网站.

I have 1 WS module and I have pluged it into some websites run on diferent servers.

我有一个程序调用 WebServices,但我想调用特定的 WebService(属于特定我的网站),所以我需要更改 <wsdlsoap:address location=""> 在运行时.

And I have a program call WebServices, but I want to invoke specific WebService (belong to specific my website), so I nedd to change value of <wsdlsoap:address location=""> at runtime.

例如,有时我想从网站 A 获取数据,我可以使用

For example, sometime I want to get data from website A I can invoke WS with

有时我想从网站 B 获取数据我可以使用

and sometime I want to get data from website B I can use

无需更改 wsdl 文件

without change wsdl file

请帮帮我!!!谢谢.

推荐答案

我已经解决了我的问题,感谢您的帮助.

I have solved my problem, thanks for your help.

这是我的代码,适用于任何想做同样事情的人

Here is my code for anyone who want to do the same

//set Endpoint Address at runtime

//Calculator is class I used to make WS
//SimpleCalculatorWS is my project

CalculatorServiceLocator locator = new CalculatorServiceLocator();
locator.setCalculatorEndpointAddress(
    "http://10.0.0.90:8080/SimpleCalculatorWS/services/Calculator");

这篇关于如何更改 &lt;wsdlsoap:address location=""&gt;在运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆