微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

webservice2

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);
 
  
  }
}

----



版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐