相关代码
相关代码测试
http://192.168.43.37:8080/score?wsdl
Java EE界面测试
在项目的src下创建服务端代码
Wsimport -keep ..?wsdl
根据wsdl文件开发代码
手机归属地查询
http://www.webxml.com.cn/zh_cn/index.aspx
http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl
1、添加axis2依赖
2、创建WebService服务
3、创建applicationContext-ws.xml文件
4、在自己WEB项目的WEB-INF目录下添加如下路径,并将services.xml复制到如下路径
services/spring/META-INF/services.xml
5、修改web.xml添加
6、测试
pom依赖<axis2.version>1.7.6</axis2.version> <xmlbeans.version>2.6.0</xmlbeans.version> <!-- 1.8 axis2依赖 START --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> <version>${axis2.version}</version> <type>pom</type> </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-transport-http</artifactId> <version>${axis2.version}</version> </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-transport-local</artifactId> <version>${axis2.version}</version> </dependency> <!-- axis2整合spring --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-spring</artifactId> <version>${axis2.version}</version> </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-adb</artifactId> <version>${axis2.version}</version> </dependency> <!-- XMLBeans是一个XML-Java绑定工具,利用它可以很方便地解析XML文档 --> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>${xmlbeans.version}</version> </dependency> <!-- axis2依赖 END --> service.xml <?xml version="1.0" encoding="UTF-8" ?> <serviceGroup> <service name="AccountWebService" scope="application"> <description>simple spring example</description> <parameter name="ServiceObjectSupplier"> org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier </parameter> <parameter name="SpringBeanName">accountWebService</parameter> <messageReceivers> <messageReceiver mep= "http://www.w3.org/2004/08/wsdl/in-only" class = "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> <messageReceiver mep= "http://www.w3.org/2004/08/wsdl/in-out" class = "org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> </messageReceivers> </service> </serviceGroup> ![]() ![]() ![]() |
备案号:湘ICP备19000029号
Copyright © 2018-2019 javaxl晓码阁 版权所有