一、工具

myEclipse

tomcat  6.0 以上版本

axis-bin-1_4.zip

二、即时发布

1、解压 axis-bin-1_4.zip

2、axis-bin-1_4.zip\axis-1_4\webapps\axis     把axis发布到tomcat服务器下,及拷贝到webapps目录下

axis 为列子项目

3、启动tomcat,访问如下即发布sucess

List 就是发布的接口位置。

5、编写java 代码,,提供方法。如下

把HelloWs.java 文件,.java 改为.jws  即 HelloWs.jws   拷贝到tomcat 项目axis下,重启服务器。

public class HelloWs {public String Welcome(String name){String result= "Welcome to learning WebSerice"+name;return result;}
}

6、访问 HelloWs.jws 如下,即SUCESS

<?xml version="1.0" encoding="UTF-8"?>-<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:intf="http://localhost:8080/axis/HelloWs.jws" xmlns:impl="http://localhost:8080/axis/HelloWs.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap" targetNamespace="http://localhost:8080/axis/HelloWs.jws"><!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)-->-<wsdl:message name="WelcomeRequest"><wsdl:part name="name" type="xsd:string"/></wsdl:message>-<wsdl:message name="WelcomeResponse"><wsdl:part name="WelcomeReturn" type="xsd:string"/></wsdl:message>-<wsdl:portType name="HelloWs">-<wsdl:operation name="Welcome" parameterOrder="name"><wsdl:input name="WelcomeRequest" message="impl:WelcomeRequest"/><wsdl:output name="WelcomeResponse" message="impl:WelcomeResponse"/></wsdl:operation></wsdl:portType>-<wsdl:binding name="HelloWsSoapBinding" type="impl:HelloWs"><wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>-<wsdl:operation name="Welcome"><wsdlsoap:operation soapAction=""/>-<wsdl:input name="WelcomeRequest"><wsdlsoap:body use="encoded" namespace="http://DefaultNamespace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:input>-<wsdl:output name="WelcomeResponse"><wsdlsoap:body use="encoded" namespace="http://localhost:8080/axis/HelloWs.jws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:output></wsdl:operation></wsdl:binding>-<wsdl:service name="HelloWsService">-<wsdl:port name="HelloWs" binding="impl:HelloWsSoapBinding"><wsdlsoap:address location="http://localhost:8080/axis/HelloWs.jws"/></wsdl:port></wsdl:service></wsdl:definitions>

wsdl文件代码

测试代码:

public static void main(String[] args) {//请求地址String  url="http://localhost:8080/axis/HelloWs.jws";//、创建服务    Service service =new Service();try {//调用服务Call call=(Call) service.createCall();//服务地址
            call.setTargetEndpointAddress(url);//请求方法call.setOperationName(new QName(url,"Welcome"));//执行调用String result=(String) call.invoke(new Object[]{"  Mrwanggang"});System.out.println(result);} catch (ServiceException e) {// TODO Auto-generated catch block
            e.printStackTrace();} catch (RemoteException e) {// TODO Auto-generated catch block
            e.printStackTrace();}}

View Code

即时发布完成

二、定制发布(WSDD)

1、编写java代码,,即要发布的方法。

 public String Wel(String name){return "欢迎您: "+name;} 

2、把编译后的文件(带包路径)拷贝到 (本地服务器)apache-tomcat-7.0.42\webapps\axis\WEB-INF\classes下

3、修改server-config.wsdd文件 (server-config.wsdd  据了解这个文件需要先写自己的.wsdd文件,然后在Axis\web-inf\下执行命令生成的)

java  org.apache.axis.client.AdminClient*.wsdd  生成的。

写自己的.wsdd文件参照如下文件deploy.wsdd

重点关注

     <!--配置服务接口--><service name="HelloWsdd" provider="java:RPC"> <!-- HelloWsdd 接口名称 --> <parameter name="className" value="com.wg.wsdd.HelloWsdd"/>   <!--接口文件位置--> <parameter name="allowedMethods" value="*"/>   <!--* 代表所有方法,也可单个指明,发布的方法--></service>

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <globalConfiguration>  <parameter name="adminPassword" value="admin"/>  <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>  <parameter name="sendXsiTypes" value="true"/>  <parameter name="sendMultiRefs" value="true"/>  <parameter name="sendXMLDeclaration" value="true"/>  <parameter name="axis.sendMinimizedElements" value="true"/>  <requestFlow>   <handler type="java:org.apache.axis.handlers.JWSHandler">    <parameter name="scope" value="session"/>   </handler>   <handler type="java:org.apache.axis.handlers.JWSHandler">    <parameter name="scope" value="request"/>    <parameter name="extension" value=".jwr"/>   </handler>  </requestFlow> </globalConfiguration> <handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/> <handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/> <handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>   <!--配置服务接口--><service name="HelloWsdd" provider="java:RPC"><parameter name="className" value="com.wg.wsdd.HelloWsdd"/>    <parameter name="allowedMethods" value="*"/>   <!--* 代表所有方法,也可单个指明<beanMapping languageSpecificType="java:anni.Order" qname="ns1:Order" xmlns:ns1="BeanService"/>--></service><transport name="http">  <requestFlow>   <handler type="URLMapper"/>   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>  </requestFlow> </transport> <transport name="local">  <responseFlow>   <handler type="LocalResponder"/>  </responseFlow> </transport>
</deployment>

View Code

3、拷贝  server-config.wsdd  到——>apache-tomcat-7.0.42\webapps\axis\WEB-INF 下即可。

4、重新启动服务器,访问 http://localhost:8080/axis/   点击 List  如下即是你发布的位置

5、测试代码

 */public static void main(String[] args) {//请求地址String  url="http://localhost:8080/axis/services/HelloWsdd";//、创建服务    Service service =new Service();try {//调用服务Call call=(Call) service.createCall();//服务地址
            call.setTargetEndpointAddress(url);//请求方法call.setOperationName(new QName(url,"Wel"));//执行调用String result=(String) call.invoke(new Object[]{"Mrwangg"});System.out.println(result);} catch (ServiceException e) {// TODO Auto-generated catch block
            e.printStackTrace();} catch (RemoteException e) {// TODO Auto-generated catch block
            e.printStackTrace();}}

View Code

定制发布完成

转载于:https://www.cnblogs.com/aGboke/p/6235083.html

Webservice学习之——即时发布与定制发布相关推荐

  1. 每日新闻丨​百度地图发布语音定制功能​;Windows 10高CPU使用率问题已解

    更多精彩,请点击上方蓝字关注我们! 每日新闻播报 第09-23期  1 趋势洞察 杨元庆:制造大国变为制造强国 需重视三个转变 近日,联想集团董事长兼CEO杨元庆在2019世界制造业大会上表示,要实现 ...

  2. ROS与Arduino学习(三)订阅与发布

    ROS与Arduino学习(三)订阅与发布 Tutorial Level:HelloWorld Next Tutorial:用ROS的Cmake编译程序 本节介绍如何在arduino中发布与订阅消息. ...

  3. 学习笔记:Qt程序打包发布

    目录 前言 步骤 前言 使用qt开发自动化测试软件,一般是先在自己的办公电脑上写,后续再发给测试机运行,需要使用Qt程序打包生成exe程序.有两种方法:"Qt Widgets Applica ...

  4. 新闻/媒体 发布接口定制_每日新闻摘要,19/4/14:老大哥在看

    新闻/媒体 发布接口定制 Plus Apple goes all in on Arcade, I/O sessions show what Google has cooking this year, ...

  5. JavaWeb和WebGIS学习笔记(三)——GeoServer 发布shp数据地图

    JavaWeb和WebGIS学习笔记(三)--GeoServer 发布shp数据地图 系列链接: Java web与web gis学习笔记(一)--Tomcat环境搭建 Java web与web gi ...

  6. 学习笔记---将Asp.Net网站发布到IIS的四种方法及注意事项

    将Asp.Net网站发布到IIS的四种方法及注意事项: 不管是那种发布方法, 第一件事情是让IIS能够支持asp.net程序, 默认IIS是不开器asp.net网站程序的支持的.在IIS中的" ...

  7. WebService学习总结(三)——使用JDK开发WebService

    一.WebService的开发手段 使用Java开发WebService时可以使用以下两种开发手段 1. 使用JDK开发(1.6及以上版本) 2.使用CXF框架开发(工作中) 二.使用JDK开发Web ...

  8. webservice学习

    1.Webservice   可返回类型   int,string,double,bool,DataTable,DataSet,ArraList,List<string[]>,string ...

  9. WebService学习总结

    本文出自 http://www.cnblogs.com/ 的 孤傲苍狼 原文网址: http://www.cnblogs.com/xdp-gacl/category/629559.html http: ...

最新文章

  1. C++求一个整数的各位数字总和(附完整源码)
  2. UBoot讲解和实践-----------讲解(一)
  3. 学做三件事、三句话、三乐、三不要
  4. ShapeNet:超实时人脸特征点检测与形状拟合开源库
  5. 【直播间】移动互联网产品中如何用好HTML5?
  6. web安全day33:人人都要懂的LNMP--nginx的配置和文件理解
  7. 机动车车牌分类及命名规则总结
  8. C4D中英文对照—材质编辑器之反射通道
  9. QQ登录界面测试用例设计:
  10. vista/win7系统 红警/CS/星际争霸 局域网连接方法
  11. gin-binding参数效验
  12. 如何清理 WinSxS 文件夹-2022版
  13. php opcode 启用,Drupal8安装提示PHP OPCODE CACHING未启用的解决方法
  14. 智慧非智能,智慧园区智慧在哪里?
  15. 骁龙780g相当于什么处理器 骁龙780g什么水平
  16. 加密视频(java加密视频)
  17. Java中的多线程安全问题
  18. python c++情侣网名是什么意思_“果然,他用的是情侣网名!”
  19. vanish_variables_3.0
  20. 2D,2.5D,3D封装结构

热门文章

  1. TypeScript 3.4 发布
  2. linux文件字节函数,各位大侠:linux/unix下有什么双字节的字符类型及其一整套处理函数? 高分送出,请帮帮小弟!!!!!!...
  3. android4.4 ssl版本查看,OkHttp在4.4及以下不支持TLS协议的解决方法
  4. concurrentbag 删除指定元素_Python 列表,for循环,元组的使用(修改、添加、删除、排序、切片)
  5. python文件移动到文件夹_python – 将文件夹中的文件移动到顶级目录
  6. hash算法_hash一致性算法
  7. linux停止rpc服务,linux下安装启动rpc服务
  8. 并注册烧写钩子 获取启动介质类型_Spark Application的注册 源码剖析
  9. python中function函数的用法_Python中Function(函数)和methon(方法)
  10. cuk电路设计及matlab仿真,cuk斩波电路仿真毕业论文,绝对精品.doc