简体   繁体   English

使用RestEasy在JAX-RS 2.0客户端API上设置请求正文

[英]Setting request body on JAX-RS 2.0 Client API With RestEasy

My first question on this community that has helped me so much already. 我对这个社区的第一个问题已经对我有所帮助。

I'm using RestEasy and trying to do a POST request to a REST service sending a JSON object. 我正在使用RestEasy,并尝试向发送JSON对象的REST服务发出POST请求。 The problem is that my JSON object keeps going as a request parameter and not in the request body, which is what I need. 问题是我的JSON对象一直作为请求参数运行,而不是在请求正文中,这正是我所需要的。

Here is how I'm doing it. 这就是我的做法。

Invocation inv = target.request().buildPost(Entity.json(shipment));

Response response = inv.invoke();

I've been looking for ours on how to put the JSON object into the request body but found nothing. 我一直在寻找如何将JSON对象放入请求正文的方法,但没有发现任何问题。

Any ideas? 有任何想法吗?

This is resolved. 解决了。 There was a problem on the web service that was receiving my request. Web服务收到我的请求时出现问题。

Thanks everyone for your comments!** 感谢大家的意见!**

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM