(1)配置axis,需要下载3个jar文件:activation.jar、mail.jar和xmlsec.jar。
(2)部署HelloWorld.jws文件(内容如下),提示“java.lang.RuntimeException: No compiler found in your classpath! (you may need to add 'tools.jar')”,将tools.jar和dt.jar文件从jdk拷贝至Tomcat 5.5/common/lib,解决。

publicclassHelloWorld...
{
publicStringsayHello(Stringname)...{
return"axissayhello:"+name;
}
}
(3)使用tcp monitor观察soap消息交换情况。
F:/Apache Software Foundation/Tomcat 5.5/webapps/axis>java org.apache.axis.utils
.tcpmon 8081 localhost 8080
request和response消息如下:
==============
ListenPort:8081
TargetHost:localhost
TargetPort:8080
====Request====
POST/axis/HelloWorld.jwsHTTP/1.0
Content-Type:text/xml;charset=utf-8
Accept:application/soap+xml,application/dime,multipart/related,text/*
User-Agent:Axis/1.4
Host:localhost:8081
Cache-Control:no-cache
Pragma:no-cache
SOAPAction:""
Content-Length:445
<?
xmlversion="1.0"encoding="UTF-8"
?>
<
soapenv:Envelope
xmlns:soapenv
="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd
="http://www.w3.org/2001/XMLSchema"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
>
<
soapenv:Body
>
<
sayHello
soapenv:encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
>
<
param1
xsi:type
="xsd:string"
>
sun
</
param1
>
</
sayHello
>
</
soapenv:Body
>
</
soapenv:Envelope
>
====Response====
HTTP/1.1200OK
Server:Apache-Coyote/1.1
Set-Cookie:JSESSIONID=9BFB75F7ADD1D9475DE9CEA3EB8724E9;Path=/axis
Content-Type:text/xml;charset=utf-8
Date:Sat,06Jan200713:33:04GMT
Connection:close
<?
xmlversion="1.0"encoding="utf-8"
?>
<
soapenv:Envelope
xmlns:soapenv
="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd
="http://www.w3.org/2001/XMLSchema"
xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
>
<
soapenv:Body
>
<
sayHelloResponse
soapenv:encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
>
<
sayHelloReturn
xsi:type
="xsd:string"
>
axissayhello:sun
</
sayHelloReturn
>
</
sayHelloResponse
>
</
soapenv:Body
>
</
soapenv:Envelope
>
==============
(4)使用wsdd(Web Service Deployment Descriptor,Web服务部署描述语言)部署服务,主要有两点:
a. 修改axis自带的“server-config.wsdd”文件,添加自定义的服务。
b.添加axis自带的web.xml文件。
这样,访问http://localhost:8080/test/services
就可以看到自己的服务了。
详细配置可参考:http://www.cnblogs.com/bjzhanghao/archive/2004/10/09/50216.aspx
Axis SOAP服务部署与测试
本文介绍如何通过Axis部署SOAP Web服务,包括所需jar文件配置、解决编译器路径问题、使用tcpmonitor观察SOAP消息交换及通过wsdd进行服务部署的方法。
1万+

被折叠的 条评论
为什么被折叠?



