Create web service using Eclipse
I am trying to create my first webservice using eclipse javaEE under Axis2, i am fo开发者_如何学编程llowing this turorial eclipse tutorial to learn how to make it.I make the webservice but when i want to assure that the ws has been deployed through viewing it through URL, an HTTP status 400 occure. How can I know what is the error?? here what i make exactly:
- i make the settings in preferences [ ant , axis2, tomcat and java ].
- New -> New dynamic web page
- new ->java (I create the class i want to convert to ws)
- new ->web service (i want to create bottom up ws).
- type http://localhost:8080/Axis2/services/listservices in the url of browser
this what return HTTP Status 404 - /services/listservices
can some one tell me how can i know what is the error? or how can i define it?
EDIT: an exception happen in the console of eclipse which is :
org.apache.axis2.transport.http.AxisAdminServlet java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet
what should I do ,in the configuration i specify where is axis2 and eclipse shows
Axis2 runtime loaded successfully
after creating new work space and create webservice again, this is the output appears in console
Dec 20, 2010 8:32:04 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path: C:\Program
Files\Java\jdk1.6.0_18\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;F:/alaa college/year 4/1st
semester/Advance sw/Libraries/eclipse/jre/bin/client;F:/alaa college/year 4/1st
semester/Advance sw/Libraries/eclipse/jre/bin;D:\app\AloOoSh\product\11.1.0\db_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_18\bin;%ANT_HOME%\bin;%AXIS2_HOME%\bin;%CATALINA_HOME%\bin;C:\Program Files\MATLAB\R2008a\bin;C:\Program Files\MATLAB\R2008a\bin\win32;
Dec 20, 2010 8:32:05 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source'
to 'org.eclipse.jst.jee.server:testFirst' did not find a matching property.
Dec 20, 2010 8:32:05 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 20, 2010 8:32:05 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 401 ms
Dec 20, 2010 8:32:05 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 20, 2010 8:32:05 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
[INFO] Deploying module: addressing-1.4 - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testF
irst/WEB-INF/modules/addressing-1.4.mar
[INFO] Deploying module: metadataExchange-1.4 -
file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/mex-1.4.mar
[INFO] Deploying module: ping-1.4 -
file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/ping-1.4.mar
[INFO] Deploying module: script-1.4 - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/scripting-1.4.mar
[INFO] Deploying module: smtpfault - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/smtpfault.mar
[INFO] Deploying module: soapmonitor-1.4 - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/modules/soapmonitor-1.4.mar
[INFO] Deploying Web service: Converter - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/services/Converter/
[INFO] Deploying Web service: version.aar - file:/D:/EclipseExcercises/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testFirst/WEB-INF/services/version.aar
Dec 20, 2010 8:32:06 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Dec 20, 2010 8:32:06 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Dec 20, 2010 8:32:06 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/19 config=null
Dec 20, 2010 8:32:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1383 ms
These is my own post to creating webservice and use that service in android. its work properly.
Try this once below link
http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/#comment-179
The 404 error occurs because there is nothing at the desired url. So there must have been something wrong with your deployment.
Have you set up a server in eclipse and actually published the WS at all? Note that this is different from running Tomcat from a directory somewhere else on your computer! You can add a server instance by selecting New => Server.
If the server configuration is otherwise correct, the server output should appear in eclipse's console, and if anything is wrong with your WS setup, there should be error messages you can use to track down the problem.
You probably extracted the contents of axis2.war (renamed to app.zip) into the wrong folder or deployed files to the wrong folder. Look for the WEB-INF folder directly under the app.war folder that you deployed. If you have another folder of WEB-INF for the axis2 extracted folders, then JBoss cannot locate them. The WEB-INF folder must be a folder as a 1st level descendant. Along with the following folders: axis2-web, META-INF and org.
精彩评论