Hi

I think it's actually a legacy bug. I think the reason it works in a unit test is because some default content type is set when Java (HTTP)UrlConnection is involved but not when a browser is used.

That said, I'm not sure one can call it a bug. Please set Content-Type to any acceptable content type, */* even, to keep you going, but in reality you can't have a GET request with a request body available at the same time. Most likely the InputStream value in your method is null.

Either way, what I will do is I'll update the code to log a warning message and 
set the type to */*.

Cheers, Sergey


Hi Wayne,

I think you'd better try with the last version 2.1.3

because there's a issue on 2.1.2 and it was fixed on that version

http://issues.apache.org/jira/browse/CXF-1699



On Mon, Dec 15, 2008 at 1:35 PM, Wang Wayne <[email protected]> wrote:

Hello All,



I have met a question when I request my local web service from Browser. The
error from Tomcat server as following:

Interceptor has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault: No Content-Type specified for HTTP GET



But still the same web service when I request from Junit test, It's work.
The request code as following:

URL url = *new* URL("
http://localhost:8000/sso/webservice/policyservice/test
");

       InputStream in = url.openStream();

       log.info(*getStringFromInputStream*(in));



This is server code:

        @GET

   @Path("/test/")

   *public* Response test(InputStream is) {

       *return* Response.*status*(Response.Status.*OK*).entity(
"<result>success</result>").build();

}

Would someone could help me, please. I really appreciate!



Best wishes for you!

Wayne Wang




--
Regards!

Chouxinxin Huang


Reply via email to