users@jersey.java.net

[Jersey] Re: Bad Checksum when using PUT

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 26 Oct 2011 11:13:11 +0200

You'll need to obtain documentation for service you are accessing.

I tried following with no success:

         MultivaluedMap<String,String> queryParams = new
MultivaluedMapImpl();
         queryParams.add("targetID", "12345");

         String url = "http://ws.irisnetlab.be/waws/nova/psk";

         Client client = Client.create();
         client.addFilter(new LoggingFilter());
         WebResource resource = client.resource(url);
         resource.queryParams(queryParams).header("Content-Length",
"0").put(String.class);

even with different Content-Length values it returns same response.

I can see that your service is implemented using Jersey
(http://ws.irisnetlab.be/application.wadl is accessible), but Jersey
itself doesn't have any hard requirement for Content-Length in headers
for PUT requests, so it must be some custom enhancement/filter.

There is nothing wrong with your client side code.

Pavel


On 10/26/11 9:24 AM, stlecho wrote:
> Here's the code I'm using:
>
>
>
>> public String *callWawsCreateKey*(String dossierId) {
>> MultivaluedMap<String,String> queryParams = new MultivaluedMapImpl();
>> queryParams.add("targetID", dossierId);
>> return *put*("http://ws.irisnetlab.be/waws/nova/psk",queryParams);
>> }
>> protected String *put*(String url, MultivaluedMap<String,String>
>> queryParams) {
>> Client client = Client.create();
>> client.addFilter(new LoggingFilter());
>> WebResource resource = client.resource(url);
>> return resource.queryParams(queryParams).put(String.class);
>> }
>>
> When running a JUnit test on /callWawsCreateKey/, I'm receiving underneath
> stack trace:
>
>
>> com.sun.jersey.api.client.UniformInterfaceException: *PUT
>> http://ws.irisnetlab.be/waws/nova/psk?targetID=123456 returned a response
>> status of 411 Length Required*
>> at com.sun.jersey.api.client.WebResource.handle(WebResource.java:676)
>> at com.sun.jersey.api.client.WebResource.put(WebResource.java:211)
>> at be.irisnet.nova.KeyWebserviceClient.put(KeyWebserviceClient.java:35)
>> at
>> be.irisnet.nova.KeyWebserviceClient.callWawsCreateKey(KeyWebserviceClient.java:15)
>> at
>> be.irisnet.nova.KeyWebserviceClientTest.testCallWawsCreateKey(KeyWebserviceClientTest.java:14)
>>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Bad-Checksum-when-using-PUT-tp6929189p6931763.html
> Sent from the Jersey mailing list archive at Nabble.com.
>