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

webservice2

发布时间:2020-12-16 23:03:37 所属栏目:安全 来源:网络整理
导读:1.http://save.do ?id=1name=''; 2.soap协议:在http的基础上传输xml数据 3.wsdl;web服务描述语言。说明服务怎么调用,,怎么调用 4.xml只是一种语法 5.只要 jdk1.6就能发布服务 6@webservice可以放在接口,可以放在类上,最终放在接口上 7.wsimport 8http:/

1.http://save.do ?id=1&name='';

2.soap协议:在http的基础上传输xml数据

3.wsdl;web服务描述语言。说明服务怎么调用,,怎么调用

4.xml只是一种语法

5.只要 jdk1.6就能发布服务

6@webservice可以放在接口,可以放在类上,最终放在接口上

7.wsimport

8http://localhost:5678/hello?wsdl

9.wsimport-s.http://localhost:5678/hello?wsdl---------下载--

10.http://www.cnblogs.com/sun_moon_earth/archive/2009/02/03/1383308.html---webservice的几种方法-

----------------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------------------------------

一、

//发布服务

package cn.itcast.service;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
/**
?*?
?* 发布服务
?* @author HP
?*
?*/
@WebService
public class HelloService {
public String ?sayHello(String name){
System.out.print("say hello called......");
return "hello"+name;
}

public static void main(String[]args){

Endpoint.publish("http://localhost:5088/hello",new HelloService());

}


}

二、

//http://localhost:5089/hello.asmx?wsdl

会生成xml文件,然后wsimport -s .?http://localhost:5089/hello.asmx?wsdl ?会生成一堆java文件

三、根据接口来调用来进行调用服务

package cn.itcast.service;
//只要上一端的代码被启动,就要测

import cn.itcast.service.HelloService;


public class Client {
?
? public static void main(String[]args){
?HelloServiceService ?hss=new HelloServiceService();
?HelloService soap=hss.getHelloServicePort();
?String str=soap.sayHello("123");
?System.out.print(str);
?
??
? }
}

----

??

(编辑:李大同)

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

    推荐文章
      热点阅读