- Axis是什么(What is Axis)
Axis is essentially a SOAP engine,The current version of Axis is written in Java, but a C++ implementation of the client side of Axis is being developed.
Axis本質(zhì)上是一個(gè)SOAP引擎,目前的Axis是用java編寫的,同時(shí)Axis還有一個(gè)C++版本(關(guān)于C++版本的Axis這里不做介紹,有興趣的朋友可以自己去研究)。
for a detailed information about what axis is,please visit the official site of axis
http://ws.apache.org/axis/java/user-guide.html
如果需要了解更多的Axis信息,請(qǐng)?jiān)L問Axis的官方網(wǎng)站
http://ws.apache.org/axis/java/user-guide.html
- SOAP是什么(What is SOAP)
SOAP stands for Simple Object Access Protocol
SOAP is a communication protocol
SOAP is for communication between applications
SOAP is a format for sending messages
SOAP communicates via Internet
SOAP is platform independent
SOAP is language independent
SOAP is based on XML
SOAP is simple and extensible
SOAP allows you to get around firewalls
SOAP is a W3C recommendation
SOAP代表簡(jiǎn)單對(duì)象訪問協(xié)議
SOAP是一種通信協(xié)議
SOAP用于在應(yīng)用程序之間的通信
SOAP是一種用于發(fā)送消息的格式
SOAP 被設(shè)計(jì)用來(lái)通過(guò)因特網(wǎng)進(jìn)行通信
SOAP 獨(dú)立于平臺(tái)
SOAP 獨(dú)立于程序語(yǔ)言
SOAP 基于 XML
SOAP 很簡(jiǎn)單并可擴(kuò)展
SOAP 允許您繞過(guò)防火墻
SOAP 將被作為 W3C 標(biāo)準(zhǔn)來(lái)發(fā)展
- 如何安裝Axis(How to install Axis in Web Application)
1.準(zhǔn)備WEB服務(wù)器(Preparing an application server)
First of all,you should have an application server or servlet engine and be familiar with operating and deploying to it. and i prefered Jakarta Tomcat which is also Axis's official site( http://ws.apache.org/axis/java/ )'s recommendation
首先,你需要擁有一個(gè)WEB服務(wù)器或者Servlet引擎,而且熟悉它的操作和部署。我更喜歡Tomcat(感覺它是國(guó)內(nèi)大多數(shù)Java開發(fā)者學(xué)習(xí)J2EE應(yīng)用的入門級(jí)服務(wù)器,簡(jiǎn)單而實(shí)用)。
2.準(zhǔn)備WEB應(yīng)用程序(Preparing the webapp)
Here I assume that you have a web server up and running on the localhost at port 8080. If your server is on a different port,never mind.
這里我假設(shè)你已經(jīng)有了一個(gè)已經(jīng)啟動(dòng)的WEB服務(wù)器,端口號(hào)為8080。如果你的端口號(hào)不同也沒關(guān)系。
Note:webapp refers to web application here.
備注:webapp在這里指的是web應(yīng)用程序
my webapp is christened "myaxis" here which is alreay deployed in Tomcat.(the detail of how to deploy webapp in Tomcat will not be metioned here)
我將我的web應(yīng)用程序命名為"myaxis",并且該web程序已經(jīng)在Tomcat中部署。(關(guān)于如何在Tomcat中部署web應(yīng)用程序,這里不會(huì)提及)
3、加入必須的jar文件(Setting up the required jar files)
there are a couple of jar files(listed below) needs to be added in your own webapp's lib folder(let's assume the lib folder of "myaxis" is "wwwroot\WEB-INF\lib")
如果想在你自己的應(yīng)用程序中使用axis,必須要將下面列表中列出的jar文件加入到你的應(yīng)用程序的lib目錄下(假設(shè)"myaxis"的lib目錄為"wwwroot\WEB-INF\lib")
AXIS必須的jar文件列表(AXIS REQUIRED JAR FILES LIST)
axis.jar
axis-ant.jar
commons-discovery*.jar
commons-logging*.jar
jaxrpc.jar
saaj.jar
wsdl4j*.jar
Note:lib folder refers to libararies folder here.
Note:* is a placeholader that substitutes the real version of jar file which depends on the version of axis.for example,Axis 1.4 uses commons-discovery-0.2.jar,commons-logging-1.0.4.jar.
備注:lib目錄在這里指libararies目錄。
備注:*代表占位符,代替該jar文件的真實(shí)版本號(hào),因?yàn)閍xis的版本不同,它使用的jar文件就有可能不同。
4、設(shè)置web.xml(Setting up the web.xml)
(將以下內(nèi)容加入你自己的web.xml)Add following text to your own web.xml
<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>
? <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>
-->
??? <session-config>
??????? <!-- Default to 5 minute session timeouts -->
??????? <session-timeout>5</session-timeout>
??? </session-config>
??? <!-- 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>
4、啟動(dòng)WEB服務(wù)器(Starting the web server)
5、驗(yàn)證Axis部署是否成功(Validate the Installation)
Navigate to http://127.0.0.1:8080/myaxis/servlet/AxisServlet,
though of course the port and the address may differ.
訪問地址http://127.0.0.1:8080/myaxis/servlet/AxisServlet,
當(dāng)然你的web應(yīng)用程序的端口或者地址可能不同。
You should now see an page as follows.
If you do not, then the webapp is not actually installed, or the appserver is not running.
你應(yīng)該可以看到下面的頁(yè)面。
如果你沒有看到下面的這個(gè)頁(yè)面,你的web應(yīng)用程序可能還沒部署,或者你的web服務(wù)器沒有運(yùn)行。

- Axis在真實(shí)項(xiàng)目中的應(yīng)用(Axis in real application)
服務(wù)發(fā)布方和服務(wù)調(diào)用方的定義
(The definition of the service publisher and the service invoker)
if the SOAP service(webservice also) which was being deployed in your webapp
(in real world,perhaps the project which your team developed)
by axis should be invoked by an external webapp
(in real world,perhaps the project which was already being published by another corp),
or probably by a couple of outer webapps.we call your webapp the service publisher,
consequently the external webapp is the service invoker.
如果你的WEB服務(wù)中(在現(xiàn)實(shí)中,指你開發(fā)的系統(tǒng))
用axis部署的SOAP服務(wù)(或者稱為WEBSERVICE服務(wù))被外部的WEB服務(wù)
(在現(xiàn)實(shí)中,可能是別的廠家開發(fā)的系統(tǒng))調(diào)用,
那么我們稱你的WEB服務(wù)為服務(wù)發(fā)布方,相應(yīng)地,外部WEB服務(wù)為服務(wù)調(diào)用方。
1、(作為服務(wù)發(fā)布方)The service publisher side
作為服務(wù)的發(fā)布方,首先需要做的是擁有一個(gè)SOAP服務(wù),
下面將詳細(xì)介紹如何用axis發(fā)布一個(gè)SOAP服務(wù)
(1)寫一個(gè)Java類,在該類中寫一個(gè)Java方法,我們的Java類名為:HalloAxis.java
public class HalloAxis {
???? public int addition(int num1,int num2)
???? {
??? return num1 + num2;
???? }
}
(2)寫一個(gè)deploy.wsdd
(3)寫一個(gè)windows批處理命令(假設(shè)你的操作系統(tǒng)是windows)
我們的批處理命令文件名為:deploy.bat
set axislib = 你的lib目錄的路徑(比如 D:/myaxis/wwwroot/WEB-INF/lib)
set classpath=.;%axislib%\axis.jar;%axislib%\axis-ant.jar;
??????????????? %axislib%\saaj.jar;%axislib%\commons-discovery*.jar;
??????????????? %axislib%\jaxrpc.jar;%axislib%\commons-logging*.jar;
java org.apache.axis.client.AdminClient -l http://localhost:8080/myaxis/servlet/AxisServlet 你的deploy.wsdd的路徑
pause
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
