本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
 本博客在此声明所有文章均为转摘,只做资料收集使用。

我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:
日志总数:1304
评论数量:2242
留言数量:5
访问次数:7593956
建立时间:2006年5月29日




[Java Open Source]Integrate Axis and Appfuse Part1
软件技术

lhwork 发表于 2007/1/23 9:02:52

Introduction The purpose of the practice is to show how to integrate Apache Axis into Appfuse. In part1, we add required libs and jsps to make a happy axis. In part2, we port webservice from appfuse service layer and make a simple test. Step 0. Check out Envirenment. Before we start, please make sure you already prepare all tools we need. appfuse 1.8.1 Eclipse 3.1 Sun JDK 1.5 Tomcat 5.5.11 ant 1.6.2 Mysql 4.1.11 Axis 1.2.1 (src and binary) Note : On Tomcat 4.x and Java1.4, you may need to put libraries that contain java.* or javax.* packages into CATALINA_HOME/common/lib, jaxrpc.jar and saaj.jar are two such libraries.(Axis mention).  Note :  (October 5, 2005): Axis 1.3 Final is now available! You can it if you like. Note  : How to setup appfuse in Eclipe, please check appuse wiki. Axis 1.2.1 comes with a axis webapp, you can find it in the path axis-1_2_1\webapps\axis in the binary distribution. All we need files come from this except axis-tasks.properties. All we do just to map axis webapp file structutr into appfuse webapp file structure. If something I lost, please check it out there. Note  : About how to install axis, please check axis intall guide here We recommand you install axis first in tomcat and see how it runs. It will help you understand more what we are doing :) Step 1. Add Axis required libs With Axis 1.2.1 binary distribution, in the path webapps\axis\WEB-INF\lib contains axis server require jars listed below. axis.jar axis-ant.jar commons-discovery-0.2.jar commons-logging-1.0.4.jar (appfuse already include) jaxrpc.jar log4j-1.2.8.jar (appfuse already include) saaj.jar wsdl4j-1.5.1.jar To make axis happy, we need to get some other jars listed. activation.jar (appfuse already include) mail.jar (appfuse already include) xalan.jar xercesImpl.jar xmlsec-1.2.1.jar To integrate ant task in appfuse, we need axis-tasks.properties.You can pick it up from axis src, it should be found in tools folder axis-tasks.properties That's all we need. Step 2. Add jars to appfuse 1. Create a folder named axis-1.2.1 under lib folder in your appfuse project. 2. Copy jars listed below into it. axis.jar axis-ant.jar commons-discovery-0.2.jar jaxrpc.jar saaj.jar wsdl4j-1.5.1.jar xalan.jar xercesImpl.jar xmlsec-1.2.1.jar axis-tasks.properties You can check the screen here. 3. Modify lib.properties and add below. you could find this file in lib folder of appfuse. ## Axis - http://ws.apache.org/axis/#axis.version=1.2.1axis.dir=${lib.dir}/axis-${axis.version} You can check the screen here. 4. Modify properties.xml and add below under <project> tag. you could find this file in the root of appfuse. <!-- Axis Classpath --><path id="axis.classpath"><path refid="xdoclet.classpath"/>  <fileset dir="${axis.dir}" includes="*.jar"/>  <fileset dir="${javamail.dir}" includes="*.jar"/> </path> You can check the screen here. 5. Modify build.xml and add below under package-web target <!-- axis lib --><lib dir="${axis.dir}" includes="*.jar"/> You can check the screen here. Details about how to add libs into appfuse please check here. Note : All the steps are simular except step 4, we will use this path later. Before step 3, I recommand you run ant setup-tomcat deploy tasks. If everything is ok, you should find axis related jars in your tomcat webapps\appfuse\WEB-INF\lib path. Step 3 Modify related web.xml setting All these files needed to modified should be found under \metadata\web in you appfuse project. 1. Modify listeners.xml and add <!-- axis --><listener><listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class></listener>   You can check the screen here. 2. Create xml file name mime-mappings.xml and add to \metadata\web path <!-- axis --><!-- currently the W3C havent settled on a media type for WSDL;     http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft     for now we go with the basic 'it's XML' response --><mime-mapping>     <extension>wsdl</extension>     <mime-type>text/xml</mime-type></mime-mapping><mime-mapping>     <extension>xsd</extension>     <mime-type>text/xml</mime-type></mime-mapping>   You can check the screen here. 3. Modify servlet-mappings.xml and add  <!-- axis -->     <servlet-mapping>     <servlet-name>AxisServlet</servlet-name>     <url-pattern>/servlet/AxisServlet</url-pattern> </servlet-mapping>  <servlet-mapping>     <servlet-name>AxisServlet</servlet-name>     <url-pattern>*.jws</url-pattern> </servlet-mapping>  <servlet-mapping>     <servlet-name>AxisServlet</servlet-name>     <url-pattern>/services/*</url-pattern> </servlet-mapping>  <servlet-mapping>     <servlet-name>SOAPMonitorService</servlet-name>     <url-pattern>/SOAPMonitor</url-pattern> </servlet-mapping>  <!-- uncomment this if you want the admin servlet --> <servlet-mapping>     <servlet-name>AdminServlet</servlet-name>     <url-pattern>/servlet/AdminServlet</url-pattern> </servlet-mapping> You can check the screen here.   Note : Here we uncomment AdminServlet servlet setting to use axis AdminServlet.If you do not need this, just mark it up. Default Axis distribution mark it up. 4.  Modify servlets.xml and add    <!-- axis -->   <servlet>        <servlet-name>AxisServlet</servlet-name>     <display-name>Apache-Axis Servlet</display-name>     <servlet-class>         org.apache.axis.transport.http.AxisServlet     </servlet-class>   </servlet>    <servlet>     <servlet-name>AdminServlet</servlet-name>     <display-name>Axis Admin Servlet</display-name>     <servlet-class>         org.apache.axis.transport.http.AdminServlet     </servlet-class>     <load-on-startup>100</load-on-startup>  </servlet>    <servlet>     <servlet-name>SOAPMonitorService</servlet-name>     <display-name>SOAPMonitorService</display-name>     <servlet-class>         org.apache.axis.monitor.SOAPMonitorService     </servlet-class>     <init-param>       <param-name>SOAPMonitorPort</param-name>       <param-value>5001</param-value>     </init-param>     <load-on-startup>100</load-on-startup>  </servlet> You can check the screen here. Step 4. Copy axis related jsps into appfuse 1. Copy list files below to appfuse. You can find these files in axis-1_2_1\webapps\axis path in axis distribution. from axis to appfuse EchoHeaders.jws happyaxis.jsp i18nLib.jsp indexAxis.jsp (rename index.jsp to indexAxis.jsp in axis) from axis\WEB-INF\classes to appfuse\WEB-INF\classes  i18n.properties i18n_ja.properties You can check the screen here. 2. Run ant clean deploy tasks 3. Start tomcat and point to http://localhost:8080/appfuse/indexAxis.jsp If all ok, you should see the image here.   Summary You could click the Validation hyperlink to check if axis runs well?Or Clikc List hyperlink to see deployed webservice.Without server-config.xml, axis default deployed AdminService and Version Service Now congraturation, you have a happy axis!!  500)this.width=500'>   You could check this screen that's a happy axis.  Note: SOAPMonitor hyperlink would not work :),  If you need it, just copy *.class under axis\WEB-INF\classes to appuse root directory More In part2, we will show port webservice from affpsue service layer.


阅读全文(3143) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.344 second(s), page refreshed 144775188 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号