如何使用Axis WSDL2Java 生成的文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1665595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Axis WSDL2Java generated files?
提问by newbie
I generated Java files from WSDL with WSDL2Java converter, but I don't know how can I use service with these files, because there are no examples. I'm implementing client side.
我使用 WSDL2Java 转换器从 WSDL 生成了 Java 文件,但我不知道如何对这些文件使用服务,因为没有示例。我正在实施客户端。
采纳答案by Andrey Adamovich
Regarding Axis2: read these these links they contain some examples:
关于 Axis2:阅读这些链接,它们包含一些示例:
http://ws.apache.org/axis2/1_5_1/quickstartguide.html#clients
http://ws.apache.org/axis2/1_0/userguide3.html
http://ws.apache.org/axis2/1_5_1/quickstartguide.html#clients
http://ws.apache.org/axis2/1_0/userguide3.html
EDIT:Regarding Axis1: it is based on JAX-RPC and you need to instantiate stub object or use service locator to get stub instance and all WS operations will be in that. An example is given here:
编辑:关于 Axis1:它基于 JAX-RPC,您需要实例化存根对象或使用服务定位器来获取存根实例,所有 WS 操作都将在其中。这里给出了一个例子:
public class Tester {
public static void main(String [] args) throws Exception {
// Make a service
AddressBookService service = new AddressBookServiceLocator();
// Now use the service to get a stub which implements the SDI.
AddressBook port = service.getAddressBook();
// Make the actual call
Address address = new Address(...);
port.addEntry("Russell Butek", address);
}
}
回答by Scanningcrew
Normally a client doesn't instantiate a stub in Web Services, you would use the service locator and call the get method. I can't tell from your question, but if you are asking a more general "Where do I get JavaDocs (or such) to better understand the API", you would have to tell use which WS you are using.
通常,客户端不会实例化 Web 服务中的存根,您将使用服务定位器并调用 get 方法。我无法从您的问题中得知,但是如果您要问更一般的“我从哪里获得 JavaDocs(或类似的)以更好地理解 API”,您将不得不告诉 use 您正在使用哪个 WS。