如何使用axis wsdl2java生成的文件?

nqwrtyyt  于 2021-07-05  发布在  Java
关注(0)|答案(2)|浏览(331)

我使用wsdl2java converter从wsdl生成了java文件,但我不知道如何使用这些文件的服务,因为没有示例。我正在实现客户端。

3zwjbxry

3zwjbxry1#

通常,客户机不会在web服务中示例化存根,您可以使用服务定位器并调用get方法。我不能从你的问题中判断,但是如果你问一个更一般的问题“我从哪里得到javadocs(或类似的东西)来更好地理解api”,你必须告诉use你正在使用哪个ws。
axis用户指南

kse8i1jr

kse8i1jr2#

关于axis2:请阅读以下链接,其中包含一些示例:
http://ws.apache.org/axis2/1_5_1/quickstartguide.html#clients
http://ws.apache.org/axis2/1_0/userguide3.html
编辑:关于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);
  }
}

相关问题