加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用IDE进行webservices客户端调用

发布时间:2020-12-16 22:59:10 所属栏目:安全 来源:网络整理
导读:1)、首先, 你要先把你的WS服务启动起来,比如http://localhost:8080/Example/services/HelloWorldService?wsdl 2)、然后,在你的另一个项目中建一个Webservice Client 客户端,用来访问你的WS服务。 建立Webservice Client 方法如下,在Eclipses中建立一个j

1)、首先, 你要先把你的WS服务启动起来,比如http://localhost:8080/Example/services/HelloWorldService?wsdl
2)、然后,在你的另一个项目中建一个Webservice Client 客户端,用来访问你的WS服务。
建立Webservice Client 方法如下,在Eclipses中建立一个java工程,然后在src上右键--NEW---Other---Web Service Client --Xfire--在WsdL url 中写上http://localhost:8080/Example/services/HelloWorldService?wsdl-----下一步结束。
在src里的会出现一些java文件,你找一个以Client结束的java文件,在里面的main方法中会有个service对象,现在你就可以直接用这个对象了,service.peerstatus(参数)这样写就行了。

????????

1、用java调用webservice客户端 public static void main(String[] args) throws MalformedURLException { ??? SimpleService simpleService=new SimpleService(); ??? SimpleServicePortType type=simpleService.getSimpleServiceHttpSoap11Endpoint(); ??? int price=type.getPrice().getReturn(); ??? String greet=type.getGreeting("ljq"); ??? System.out.println(price+" : "+greet); }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读