DELETE with body

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DELETE with body

Matthew Broadhead
i am using cxf webclient to communicate with a rest server that needs a
delete command to send a body.  it can't seem to do that. is there a
workaround?

Reply | Threaded
Open this post in threaded view
|

Re: DELETE with body

Andy McCright
Hi Matthew,

If you are using the WebClient APIs directly, you can call the
invoke(String method, Object body) method - under the covers, that's what
the delete() method does - for example:
    response = webClient.invoke("DELETE", myMsgBody);

Likewise in the JAX-RS Client APIs, you would use the 'method' method, like:
    response = client.target(url).request().method("DELETE",
Entity.json(myObject));

Hope this helps,

Andy

On Mon, Dec 11, 2017 at 3:33 PM, Matthew Broadhead <
[hidden email]> wrote:

> i am using cxf webclient to communicate with a rest server that needs a
> delete command to send a body.  it can't seem to do that. is there a
> workaround?
>
>
Reply | Threaded
Open this post in threaded view
|

Re: DELETE with body

Sergey Beryozkin
Administrator
Hi Andy

As far as I recall HttpURLConnection does not support DELETE with the body,
So the solution is to add the async conduit module,
JAXRSAsyncClientTest#deleteWithBody shows it

Cheers, Sergey
On 12/12/17 04:04, Andy McCright wrote:

> Hi Matthew,
>
> If you are using the WebClient APIs directly, you can call the
> invoke(String method, Object body) method - under the covers, that's what
> the delete() method does - for example:
>      response = webClient.invoke("DELETE", myMsgBody);
>
> Likewise in the JAX-RS Client APIs, you would use the 'method' method, like:
>      response = client.target(url).request().method("DELETE",
> Entity.json(myObject));
>
> Hope this helps,
>
> Andy
>
> On Mon, Dec 11, 2017 at 3:33 PM, Matthew Broadhead <
> [hidden email]> wrote:
>
>> i am using cxf webclient to communicate with a rest server that needs a
>> delete command to send a body.  it can't seem to do that. is there a
>> workaround?
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: DELETE with body

Matthew Broadhead
In reply to this post by Andy McCright
Hi Andy,

Sorry I just got back to this after the holidays.

It works perfectly using .invoke("DELETE", myMsgBody) thank you.

Matthew

On 12/12/2017 05:04, Andy McCright wrote:

> Hi Matthew,
>
> If you are using the WebClient APIs directly, you can call the
> invoke(String method, Object body) method - under the covers, that's what
> the delete() method does - for example:
>      response = webClient.invoke("DELETE", myMsgBody);
>
> Likewise in the JAX-RS Client APIs, you would use the 'method' method, like:
>      response = client.target(url).request().method("DELETE",
> Entity.json(myObject));
>
> Hope this helps,
>
> Andy
>
> On Mon, Dec 11, 2017 at 3:33 PM, Matthew Broadhead <
> [hidden email]> wrote:
>
>> i am using cxf webclient to communicate with a rest server that needs a
>> delete command to send a body.  it can't seem to do that. is there a
>> workaround?
>>
>>