●Tomcat下載:(version 7.0.11)
apache-tomcat-7.0.11
●Axis2:(version 1.5.4)
axis2-1.5.4-bin.zip
axis2-1.5.4-war.zip
axis2-1.5.4-bin.zip
axis2-1.5.4-war.zip
二、環境變數
●Tomcat:
TOMCAT_HOME = apache-tomcat-7.0.11 解壓縮路徑\lib
JAVA_HOME 加入 %TOMCAT_HOME%;
●Axis:
●Tomcat:
TOMCAT_HOME = apache-tomcat-7.0.11 解壓縮路徑\lib
JAVA_HOME 加入 %TOMCAT_HOME%;
●Axis:
AXIS_HOME = axis2-1.5.4-bin 解壓縮路徑\lib
JAVA_HOME 加入 %AXIS_HOME%;
三、安裝步驟
Step1.安裝Tomcat,解壓縮 tomcat 至 %TOMCAT_HOME%
Step2.啟動 %TOMCAT_HOME%\bin\startup.bat,測試http://localhost:8080
Step6.完成
四、發布Web Service:Hello World
Step1.在%TOMCAT_HOME%\wepps\axis2\WEB-INF\services下,創一個Hello資料夾
Step2.建立HelloWorld.java,compiler產生.class
public class HelloWorld
{
public String echo(String str) //提供的Method
{
return str;
}
}
Step3.建立META-INF資料夾,創一個service.xml放在裡面,並將Step2.3的檔案放在Hello下
<service name="Hello" > //service name = 資料夾名稱
<Description>
Hello World Test
</Description>
//parameter name= Class名稱
<parameter name="ServiceClass" locked="false">HelloWorld</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>
Step3.重啟Tomcat,點選Service
Step3.完成
除錯記錄:
1.Error: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag ;
參數tag打錯
Step1.安裝Tomcat,解壓縮 tomcat 至 %TOMCAT_HOME%
Step2.啟動 %TOMCAT_HOME%\bin\startup.bat,測試http://localhost:8080
Step3.解壓縮Axis至%AXIS_HOME%
Step4.解壓縮axis.war至%TOMCAT_HOME%\wepps
Step5.重起Tomcat,wepps下會多一個axis2資料夾,測試http://localhost:8080/axis2
Services -- 觀看已 desploy 的 web services.
Validate -- 確定系統是否缺少 必要的library.
Administration -- axis2 管理控制台.
Validate -- 確定系統是否缺少 必要的library.
Administration -- axis2 管理控制台.
點選 Validate 檢查安裝內容
四、發布Web Service:Hello World
Step1.在%TOMCAT_HOME%\wepps\axis2\WEB-INF\services下,創一個Hello資料夾
Step2.建立HelloWorld.java,compiler產生.class
public class HelloWorld
{
public String echo(String str) //提供的Method
{
return str;
}
}
Step3.建立META-INF資料夾,創一個service.xml放在裡面,並將Step2.3的檔案放在Hello下
<service name="Hello" > //service name = 資料夾名稱
<Description>
Hello World Test
</Description>
//parameter name= Class名稱
<parameter name="ServiceClass" locked="false">HelloWorld</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>
Step3.重啟Tomcat,點選Service
Step3.完成
除錯記錄:
1.Error: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag ;
參數tag打錯
2.Error: org.apache.axis2.deployment.DeploymentException: Invalid service. META-INF directory not found
META-INF資料夾未加入
3.Error: org.apache.axis2.AxisFault: Two services cannot have same name
META-INF/service.xml 的 <service name> 取到相同名字
4.Error: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation:
沒有 .class檔
META-INF資料夾未加入
3.Error: org.apache.axis2.AxisFault: Two services cannot have same name
META-INF/service.xml 的 <service name> 取到相同名字
4.Error: org.apache.axis2.deployment.DeploymentException: The following error occurred during schema generation:
沒有 .class檔
沒有留言:
張貼留言