Akki
2010-02-04 14:46:27 UTC
I am trying to call the restful web service - delete method using the jersey
client (using following piece of code):
ClientResponse response = Client.create().resource(url).entity(mvp,
MediaType.APPLICATION_XML).delete(ClientResponse.class);
But, I am getting the error message:
com.sun.jersey.api.client.ClientHandlerException:
java.net.ProtocolException: HTTP method DELETE doesn't support output
Complete trace is given below.
Could you please let me know if this error is fixed OR is there any other
way in which I can make this call? I also tried calling it with
ApacheHttpClient but, as per my understanding it is used to make simple GET
and POST requests (not DELETE) to a Web resource.
Error trace:
com.sun.jersey.api.client.ClientHandlerException:
java.net.ProtocolException: HTTP method DELETE doesn't support output
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:193)
at com.sun.jersey.api.client.Client.handle(Client.java:404)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:462)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:64)
at
com.sun.jersey.api.client.WebResource$Builder.delete(WebResource.java:420)
at
com.sonymusic.mediapublisher.test.resources.TestMediaResourceJersey.testDeleteMediaGroupsAndAssets(TestMediaResourceJersey.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.net.ProtocolException: HTTP method DELETE doesn't support
output
at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:886)
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler.writeEntity(URLConnectionClientHandler.java:313)
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:229)
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:191)
... 24 more
client (using following piece of code):
ClientResponse response = Client.create().resource(url).entity(mvp,
MediaType.APPLICATION_XML).delete(ClientResponse.class);
But, I am getting the error message:
com.sun.jersey.api.client.ClientHandlerException:
java.net.ProtocolException: HTTP method DELETE doesn't support output
Complete trace is given below.
Could you please let me know if this error is fixed OR is there any other
way in which I can make this call? I also tried calling it with
ApacheHttpClient but, as per my understanding it is used to make simple GET
and POST requests (not DELETE) to a Web resource.
Error trace:
com.sun.jersey.api.client.ClientHandlerException:
java.net.ProtocolException: HTTP method DELETE doesn't support output
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:193)
at com.sun.jersey.api.client.Client.handle(Client.java:404)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:462)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:64)
at
com.sun.jersey.api.client.WebResource$Builder.delete(WebResource.java:420)
at
com.sonymusic.mediapublisher.test.resources.TestMediaResourceJersey.testDeleteMediaGroupsAndAssets(TestMediaResourceJersey.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.net.ProtocolException: HTTP method DELETE doesn't support
output
at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:886)
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler.writeEntity(URLConnectionClientHandler.java:313)
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:229)
at
com.sun.jersey.impl.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:191)
... 24 more
--
View this message in context: http://n2.nabble.com/Error-HTTP-method-DELETE-doesn-t-support-output-tp4513829p4513829.html
Sent from the Jersey mailing list archive at Nabble.com.
View this message in context: http://n2.nabble.com/Error-HTTP-method-DELETE-doesn-t-support-output-tp4513829p4513829.html
Sent from the Jersey mailing list archive at Nabble.com.