如何使用 Eclipse 生成的 webservice-client 类?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4145326/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:18:27  来源:igfitidea点击:

How to use the webservice-client classes generated with Eclipse?

javaweb-serviceseclipsewebservice-clientaxis

提问by Abu Muhammad

I used eclipse Helios to create a Web Service Client for consuming an axis 1.4 web service.
It generated 2 packages:
1 - datamodel.
2 - client.

我使用 eclipse Helios 创建了一个 Web 服务客户端,用于使用轴 1.4 Web 服务。
它生成了 2 个包:
1 - 数据模型。
2 - 客户端。

Inside client package there are 5 classes:
1- ServiceName
2- ServiceNameProxy
3- ServiceNameService
4- ServiceNameServiceLocator
5- ServiceNameSoapBindingStub

在客户端包中有 5 个类:
1- ServiceName
2- ServiceNameProxy
3- ServiceNameService
4- ServiceNameServiceLocator
5- ServiceNameSoapBindingStub

I need to Know what are these ? AND
How to call the web service methods with parameters?

我需要知道这些是什么?AND
如何使用参数调用 Web 服务方法?

Thanks in advance

提前致谢

回答by bmeding

I am verynew to Web Services and I can't give a good explanation of whatthose classes are, but, I believe you can use the Proxyclass to call the Web Service methods.

我对 Web 服务陌生,我无法很好地解释这些类是什么,但是,我相信您可以使用Proxy该类来调用 Web 服务方法。

public class TestClient{
    public static void main(String []args){
        ServiceNameProxy proxy = new ServiceNameProxy();
        proxy.setEndpoint("http://localhost:8080/ServiceName/asdf");//defined in wsdl

        int i = proxy.webServiceMethod(new String(), new String());
    }
}

webServiceMethod()would be whatever the name of the method is defined in the service.

webServiceMethod()将是服务中定义的任何方法的名称。