aspose file tools*
The moose likes Web Services and the fly likes Sending JSON and another parameter in HTTPPost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Sending JSON and another parameter in HTTPPost" Watch "Sending JSON and another parameter in HTTPPost" New topic
Author

Sending JSON and another parameter in HTTPPost

Alex Armenteros
Ranch Hand

Joined: May 05, 2010
Posts: 67
Edit: My way of sending the parameters was correct, on the browser the petition was a Get and the answer was different.

I need to do a POST call like this

http://url.com/endpoint?token=accessToken&action={"changePrice":"33"}

I've tried the url directly on a browser and it works

but doing this on a Java application behaves differently


I've tried encoding the entire URL and I get an error about the host not being blank.
I think the error is on the updates parameter only, but no clue where and why.

I know there are lots os similar cases, but those cases only send one parameter, the JSON, here I must send the JSON and the token separately

Librarys

Google-GSON 2.2.2
apache httpclient 4.2.3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending JSON and another parameter in HTTPPost
 
Similar Threads
Help posting .wav file in http request with HttpPost
cannot connect to my MySQL db using HttpClient
A 404 Error, need help configuring web.xml
jQuery.getJSON callback not executing
Hibernate StackOverflowError: bidirectional many-to-many