<!-- [if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:UseFELayout/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!-- [if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]-->
axis发布webservice有很多中方式,基于wsdl,wsdd等等,配置xml太麻烦,还是写点最最基础的:<!-- [if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->
<!-- [if !supportLists]-->1.
<!-- [endif]-->写一个
java
类有一些基本函数
public class Test{
//fields
private String name="gaga";
public String setName(String name){
this.name=name;
return "hello "+this.name;
}
}
<!-- [if !supportLists]-->2.
<!-- [endif]-->axis
的完整包中有
webapps
文件夹,里面有一个
axis
文件夹,把它复制到
$TOMCAT_HOME/webapps/
下,并将刚才写的
Test.java
改名为
Test.jws(java web service)
并放到
$TOMCAT_HOME/webapps/axis/
下,启动
tomcat
,可以输入网址:
http://localhost:8080/Test.jws?wsdl
查看他的
wsdl
文件,这是由
/webapps/axis
内的文件动态生成的。这个时候其实已经发布
web
服务了。
<!-- [if !supportLists]-->3.
<!-- [endif]-->编写
web service
客户端:(把
axis
的
jar
包加到项目
classpath
中)
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestWebService{
public static void main(String args[]){
System.out.println("Start invoking....");
try {
String endpoint =
"http://localhost:8080/axis/Test.jws";//你写的那个文件
String newName=new String("tianwei");
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName("setName");//填写你要调用的方法名称
//call.addParameter("name", XMLType.SOAP_STRING, ParameterMode.IN);
//call.setReturnClass(String.class);
//下面是来调用webservice函数的,Call已经绑定函数setName(String name)
//了,new Object[]{newName}中newName是传入的参数。当然,大括号内可以有
//不止一个参数
String name=(String)call.invoke(new Object[]{newName});
System.out.println(name);
} catch (Exception e) {
System.err.println(e.toString());
}
System.out.println("Finished the invoking.");
}
}
运行结果
:
Start invoking....
hello tianwei
Finished the invoking.
分享到:
相关推荐
本案例实现使用Axis2生成.arr包发布WebService服务,并使用Axis2生成客户端代码方式调用WebService
axis2-1.4.1-war.zip axis2-eclipse-codegen-wizard-1.4.zip axis2-eclipse-service-archiver-wizard-1.4.zip axis2创建webservice.txt(教程链接)
Eclipse + Axis2发布WebService
axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例
axis2发布webservice的详细介绍文档
axis发布webservice教程axis发布webservice教程axis发布webservice教程axis发布webservice教程
Axis1发布webservice服务,demo项目,已包含所需的jar包等各种文件,下载导入即可启动运行,有问题的欢迎咨询哈
Axis2创建WebService
axis2实现webservice功能,详细的myeclipse配置及xml配置
AXIS2发布WebService,博客,http://blog.csdn.net/binyulong/article/details/78713667
简单例子:axis2整合spring发布webservice,以及session的管理
Axis2开发webservice总结
Axis2发布webservice包
Axis2(WebService)经典教程,详细讲述了如何用axis2实现webservice,由浅入深,配合实例。
用AXIS2发布WebService的方法
基于axis2的webservice的demo
资源包含了:axis2-1.7.4-bin.zip、axis2-1.7.4-war.zip、axis2-eclipse-...备注:资源超过了70M 分成了3部分 见axis2方式开发webservice(一)和 axis2方式开发webservice(二)、 axis2方式开发webservice(三)
Axis2开发webservice总结,资源一般,希望对大家有用
经典入门:Axis2创建webservice.pdf
axis2-webservice axis2-webservice axis2-webservice axis2-webservice axis2-webservice