1、找到axis2.xml文件。它位于<CATALINA_HOME>/webapps/axis2/WEB-INF/conf目录下,添加下面一句话:
4、<CATALINA_HOME>/webapps/axis2/WEB-INF/lib下有个jar文件叫做soapmonitor- 1.4.1.jar,把它解压到axis2根目录<CATALINA_HOME>/webapps/axis2。
5、浏览器的地址是:http://localhost:8080/axis2/SOAPMonitor
6、在这里,我们需要注意一个配置问题,如果tomcat下有多个axis应用,设置了多个SOAPmonitor,我们则需要更改 SOAPmonitor的端口(axis默认配置的是5001),否则会产生冲突,运行SOAPmonitor时会无法启动,提示the soap monitor is unable to communcate with the server,解决方法如下:
打开C:/Tomcat5/webapps/axis/WEB-INF目录下的web.xml,将其中的SOAPMonitorPort 5001改成5002,依此类推。
7、官方帮助:http://ws.apache.org/axis2/1_3/soapmonitor-module.html
利用SOAPMonitor可以看到SOAP和REST消息的不同。
SOAP: target service: http://localhost:8080/axis2/services/TemperatureWebService
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns1:c2fConvertion xmlns:ns1="http://example.ws">
<ns1:cValue>32.0</ns1:cValue>
</ns1:c2fConvertion>
</soapenv:Body>
</soapenv:Envelope>
REST:target service: /axis2/services/TemperatureWebService
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:c2fConvertion xmlns:ns="http://example.ws">
<ns:cValue>32</ns:cValue>
</ns:c2fConvertion>
</soapenv:Body>
</soapenv:Envelope>
因为我们axis2.xml中enable了REST,所以,REST消息在内部还是转为SOAP消息来处理。