axis2 webservicee axis2开发所需哪些包

spring + axis2 开发webservice
spring + axis2 开发webservice
12:21:00来源:
项目包结构:jar包之类的直接copy进去,重复的去掉。service.xml的配置(注意结构)&?xml version="1.0" encoding="UTF-8"?&&serviceGroup&
&service name="AllWebService"&
&description&logisticsAllWebServiceInterface:Spring POJO Axis2 Service Sample&/description&
&parameter name="ServiceClass"&com.zsxh.logistics.service.webservice.AllService&/parameter& //接口类 &parameter name="ServiceObjectSupplier"&
org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
&/parameter&
&parameter name="SpringBeanName"&allWebService&/parameter& // spring管理的类的id。 &messageReceivers&
&messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /&
&/messageReceivers&
&/service& &/serviceGroup&?? axis2-web文件夹下面listServices.jsp&%@ page contentType="text/charset=UTF-8" language="java" %&&%@ page import="org.apache.axis2.Constants,
org.apache.axis2.description.AxisOperation,
org.apache.axis2.description.AxisService,
java.util.Collection,
java.util.HashMap,
java.util.Iterator" %&&html& &head&&title&List Services&/title& &style& h2{margin:20 0 5 0;} ul{margin-top:5;} &/style& &/head& &body& &h1&Available services&/h1& &%
HashMap serviceMap = (HashMap) request.getSession().getAttribute(Constants.SERVICE_MAP);
Collection servicecol = serviceMap.values();
if(servicecol.size()==0){%&Available services is Empty.&%}
for (Iterator iterator = servicecol.iterator(); iterator.hasNext();) {
AxisService axisService = (AxisService) iterator.next();
Iterator opItr = axisService.getOperations();
String serviceName = axisService.getName(); %&
&h2&&font color="blue"&&a href="&%=serviceName %&?wsdl" target="_blank"&&%=serviceName%&&/a&&/font&&/h2& &i&Available Operations&/i& &ul& &% while (opItr.hasNext()) {
AxisOperation axisOperation = (AxisOperation) opItr.next();
%&&li&&%=axisOperation.getName().getLocalPart()%&&/li&&% } %& &/ul& &%
} %& &/body& &/html&web。xml增加&!-- axis2 servlet begin --&&servlet& &display-name&Apache-Axis2&/display-name& &servlet-name&AxisServlet&/servlet-name& &servlet-class&org.apache.axis2.transport.http.AxisServlet&/servlet-class& &load-on-startup&1&/load-on-startup& &/servlet& &servlet-mapping& &servlet-name&AxisServlet&/servlet-name& &url-pattern&/services/*&/url-pattern& &/servlet-mapping&访问:http://***:**/**/services/listServices能看到你的项目中有什么webservice接口。String address = "http://localhost:8888/logistics/services/AllWebService";EndpointReference target = new EndpointReference(address);RPCServiceClient serviceClient = new RPCServiceClient();Options options = serviceClient.getOptions();options.setTo(target);// 扫描流水号// QName opGetWeather = new QName("http://****","cgInfo");//// Object[] opGetWeatherArgs = new Object[]{"c001g00001"};// Class[] returnType = new Class[]{CGInfo.class};// Object[] response = serviceClient.invokeBlocking(opGetWeather, opGetWeatherArgs, returnType);// CGInfo ret = (CGInfo) response[0];// if(ret == null){// System.out.println(" has no record");// }else{// System.out.println(ret.getClient());// System.out.println(ret.getGoodsName());// System.out.println(ret.getSpec());// System.out.println(ret.getBatchNum());// System.out.println(ret.getOddNum());// }如何调用webservice接口做测试。
学习--struts1与struts2本质区别--axis2开发webservice( web项目中集成axis2 )
axis2开发webservice( web项目中集成axis2 )
☆ 特别推荐:希望有缘来到小站的用户们,如果平时需要服务器主机托管,云服务,机房机柜带宽租用等,可以交个朋友,我叫董礼 QQ
真诚交友,用心服务,价格最低!
axis2中的webservice接口已经脱离项目单独发布,但这样不利于项目的开发,下面我们就讲一下如何在项目中集成axis2
1.首先去官网上下载axis2-1.6.2-war.zip 和
axis2-1.6.2-bin.zip (目前官网最新的)下载地址:
http://axis.apache.org/axis2/java/core/download.cgi
axis2-1.6.2-war.zip 用来部署webservice服务的,在我们集成到项目中需要里面的东西,axis2-1.6.2-bin.zip 主要是用来生成客户端代码(一般不需要)。
2.解压axis2-1.6.2-war.zip 目录结构如下:
=================================在项目中引入jar=============================
这一步是必须的,要自己的项目中引入开源组件第一步就是引入jar,当然这个过程中最麻烦的就是jar冲突的
问题,这个只有靠自己的经验+度娘去解决了。
===========================================================================
3.我们把conf和modules放在工程的WEB-INF下 axis2-web是axis2的控制台页面,建议也放入项目中(如果没有这个在配置错的情况下后台会报错)最后在axis2-web创建一个services文件夹,里面在新建一个你的服务的目录,在你的服务目录里面新建META-INF 并在该目录下加入配置文件 项目的目录结构如下:
5.在web.xml中加入axis2的核心过滤器(有点向struts2配置)
6.编写我们的服务端代码(该服务就一个简单的返回一个信息的方法):
package com.ll.axis2.
public class MyAxis2WebServer {
String Axis2WebServer(String str){
return “用户发送的信息为:”+
}}7.配置服务在WebContent/WEB-INF/services/AxisService/META-INF/services.xml 配置我们要发布的服务
&service name=”AxisService”& &description&AxisService&/description& &parameter name=”ServiceClass”&com.ll.axis2.server.MyAxis2WebServer&/parameter& &operation name=”Axis2WebServer”&
&messageReceiver class=”org.apache.axis2.rpc.receivers.RPCMessageReceiver” /& &/operation&&/service&
8.验证发布的服务(如果程序引入axis2-web就可以打开如下也页面);
或wsdl地址:
http://localhost/MGESB/services/AxisService?wsdlwebservice_axis2_work 非常实用而且强大的框架,主要支持与 开发 Jsp/ let 238万源代码下载-
&文件名称: webservice_axis2_work
& & & & &&]
&&所属分类:
&&开发工具: Java
&&文件大小: 18891 KB
&&上传时间:
&&下载次数: 10
&&提 供 者:
&详细说明:非常实用而且强大的框架,主要支持与webservice开发-Very practical and powerful frame, the main support and webservice development
文件列表(点击判断是否您需要的文件,如果是垃圾请在下面评价投诉):
&&webservice_axis2_demo&&.....................\.classpath&&.....................\.myeclipse&&.....................\.mymetadata&&.....................\.project&&.....................\.settings&&.....................\.........\.jsdtscope&&.....................\.........\org.eclipse.jdt.core.prefs&&.....................\.........\org.eclipse.wst.jsdt.ui.superType.container&&.....................\.........\org.eclipse.wst.jsdt.ui.superType.name&&.....................\src&&.....................\...\HelloWorld.java&&.....................\WebRoot&&.....................\.......\index.jsp&&.....................\.......\META-INF&&.....................\.......\........\MANIFEST.MF&&.....................\.......\WEB-INF&&.....................\.......\.......\classes&&.....................\.......\.......\.......\HelloWorld.class&&.....................\.......\.......\lib&&.....................\.......\.......\...\activation-1.1.jar&&.....................\.......\.......\...\antlr-2.7.7.jar&&.....................\.......\.......\...\axiom-api-1.2.12.jar&&.....................\.......\.......\...\axiom-dom-1.2.12.jar&&.....................\.......\.......\...\axiom-impl-1.2.12.jar&&.....................\.......\.......\...\axis2-adb-1.6.1.jar&&.....................\.......\.......\...\axis2-adb-codegen-1.6.1.jar&&.....................\.......\.......\...\axis2-ant-plugin-1.6.1.jar&&.....................\.......\.......\...\axis2-clustering-1.6.1.jar&&.....................\.......\.......\...\axis2-codegen-1.6.1.jar&&.....................\.......\.......\...\axis2-corba-1.6.1.jar&&.....................\.......\.......\...\axis2-fastinfoset-1.6.1.jar&&.....................\.......\.......\...\axis2-java2wsdl-1.6.1.jar&&.....................\.......\.......\...\axis2-jaxbri-1.6.1.jar&&.....................\.......\.......\...\axis2-jaxws-1.6.1.jar&&.....................\.......\.......\...\axis2-jibx-1.6.1.jar&&.....................\.......\.......\...\axis2-json-1.6.1.jar&&.....................\.......\.......\...\axis2-kernel-1.6.1.jar&&.....................\.......\.......\...\axis2-metadata-1.6.1.jar&&.....................\.......\.......\...\axis2-mtompolicy-1.6.1.jar&&.....................\.......\.......\...\axis2-saaj-1.6.1.jar&&.....................\.......\.......\...\axis2-soapmonitor-servlet-1.6.1.jar&&.....................\.......\.......\...\axis2-spring-1.6.1.jar&&.....................\.......\.......\...\axis2-transport-http-1.6.1.jar&&.....................\.......\.......\...\axis2-transport-local-1.6.1.jar&&.....................\.......\.......\...\axis2-xmlbeans-1.6.1.jar&&.....................\.......\.......\...\bcel-5.1.jar&&.....................\.......\.......\...\commons-cli-1.2.jar&&.....................\.......\.......\...\commons-codec-1.3.jar&&.....................\.......\.......\...\commons-fileupload-1.2.jar&&.....................\.......\.......\...\commons-httpclient-3.1.jar&&.....................\.......\.......\...\commons-io-1.4.jar&&.....................\.......\.......\...\commons-logging-1.1.1.jar&&.....................\.......\.......\...\geronimo-annotation_1.0_spec-1.1.jar&&.....................\.......\.......\...\geronimo-jaxws_2.2_spec-1.0.jar&&.....................\.......\.......\...\geronimo-jta_1.1_spec-1.1.jar&&.....................\.......\.......\...\geronimo-saaj_1.3_spec-1.0.1.jar&&.....................\.......\.......\...\geronimo-stax-api_1.0_spec-1.0.1.jar&&.....................\.......\.......\...\geronimo-ws-metadata_2.0_spec-1.1.2.jar&&.....................\.......\.......\...\httpcore-4.0.jar&&.....................\.......\.......\...\jalopy-1.5rc3.jar&&.....................\.......\.......\...\jaxb-api-2.1.jar&&.....................\.......\.......\...\jaxb-impl-2.1.7.jar&&.....................\.......\.......\...\jaxb-xjc-2.1.7.jar&&.....................\.......\.......\...\jaxen-1.1.1.jar&&.....................\.......\.......\...\jaxws-tools-2.1.3.jar&&.....................\.......\.......\...\jettison-1.0-RC2.jar&&.....................\.......\.......\...\jibx-bind-1.2.jar&&.....................\.......\.......\...\jibx-run-1.2.jar&&.....................\.......\.......\...\jsr311-api-1.0.jar&&.....................\.......\.......\...\juli-6.0.16.jar&&.....................\.......\.......\...\log4j-1.2.15.jar&&.....................\.......\.......\...\mail-1.4.jar&&.....................\.......\.......\...\mex-1.6.1-impl.jar&&.....................\.......\.......\...\neethi-3.0.1.jar&&.....................\.......\.......\...\regexp-1.2.jar&&.....................\.......\.......\...\tribes-6.0.16.jar&&.....................\.......\.......\...\woden-api-1.0M9.jar&&.....................\.......\.......\...\woden-impl-commons-1.0M9.jar&&.....................\.......\.......\...\woden-impl-dom-1.0M9.jar&&.....................\.......\.......\...\wsdl4j-1.6.2.jar&&.....................\.......\.......\...\wstx-asl-3.2.9.jar&&.....................\.......\.......\...\xalan-2.7.0.jar&&.....................\.......\.......\...\xml-resolver-1.2.jar&&.....................\.......\.......\...\xmlbeans-2.3.0.jar&&.....................\.......\.......\...\XmlSchema-1.4.7.jar&&.....................\.......\.......\web.xml
&相关搜索:
&输入关键字,在本站238万海量源码库中尽情搜索:
&[] - 使用Apache CXF编写的一个Web Project,想学CXF的可以下载!
&[] - 微博 servlet 模仿新浪微博,实现的一个功能
&[] - Web Service是现在最适合实现SOA的技术,而Axis2是实现Web Service的一种技术框架(架构)。 上传我的文档
 下载
 收藏
希望能对大家的学习和工作有所帮助,如果还有其他的疑问或需要了解更多的内容可以给我QQ或邮箱留言或发站内信,我会尽力为大家解决。
 下载此文档
正在努力加载中...
axis2_WebService_开发指南
下载积分:440
内容提示:axis2_WebService_开发指南
文档格式:DOCX|
浏览次数:10|
上传日期: 21:17:20|
文档星级:
该用户还上传了这些文档
axis2_WebService_开发指南
官方公共微信

我要回帖

更多关于 axis2 webservice 的文章

 

随机推荐