My server class looks like this:
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Path("/hello")
public class Hello {
// This method is called if XML is request
@GET
@Path("/xmlHello")
@Produces ( "application/xml" )
public String sayXMLHello() {
System.out.println("in");
String s = "";
try {
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream(
"D:\\Testing\\test.xml");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new
InputStreamReader(in));
String strLine;
// Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
s += strLine;
}
// Close the input stream
in.close();
} catch (Exception e) {// Catch exception if any
System.err.println("Error: " + e.getMessage());
}
System.out.println("File read");
return s;
}
}
and this is the contents of my cxf.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="restService" address="http://localhost:8080/RESTApp"
serviceClass="com.amadeus.Server.Hello" />
<jaxrs:client id="restClient" serviceClass="com.amadeus.Client.Test" />
</beans>
Please tell me if I am doing something wrong in the configuration.
Thank you
--
View this message in context:
http://camel.465427.n5.nabble.com/Exception-in-restful-web-service-tp5727019p5727107.html
Sent from the Camel - Users mailing list archive at Nabble.com.