Академический Документы
Профессиональный Документы
Культура Документы
1. Tomcat
2. Eclipse Helios
<param-value>WEB-INF/services.xml</param-value>
See the above line
So we will create a new file in WEB-INF and save it as services.xml
</beans>
Note the above line in services.xml file. It needs a class called DemoService
in org.demo.service package.
Click Finish
Add 2 simple methods to the class with @GET Request Method designator
package org.demo.services;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@GET
@Path("/version")
@Produces("text/plain")
public String getVersion(){
return "3.0";
}
@GET
@Path("/scope")
@Produces("application/xml")
public String getScope(){
return "<scopeName>Scope-1</scopeName>";
}
}
Ohh lots of error as we have not included any libraries yet
Let’s add the CXF library. Right click on the Demo folder and click on Properties at the bottom
Click on Add Library…. Button on right side
Select User Library
Next
Ok
See errors gone but 1 moment these jar are not added to your server Tomcat so Click on Markers Tab
Click on Finish button
Now you are ready to run the application
Click on Finish
http://localhost:8080/Demo/DemoService/version
http://localhost:8080/Demo/DemoService/scope