Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2008

Tip: Looking for answers? Try searching our database.

Sending a JSON object from a client Java program to a Tomcat servlet

Thread view: 
valheru@chariot.net.au - 21 Feb 2008 02:51 GMT
Hi,

I am using the json.org tools to serialize and deserialize a JSON
object with no problems.

However, once I have serialized the JSON object in the form "{"<key>":
"<value>", "<key>", "<value>" etc }

how do I "send" this string to the Tomcat servlet so that it can pick
it up and interpret it as a JSON object which acts as a parameter to a
Java method?

I was thinking of Http-ing to the method, but all that displays is the
error response of the function:

{"msg":"invalid service call","error":true} (but this proves that I'm
http-ing to the right address, at least, since I'm getting back some
serialized JSON data)

I want to make it so that this response comes back as "error": false,
because it will have accepted my JSON object as a string. But once
I've serialized (read: turned in to String) my JSON object I don't
know how to send it across to the server. Do I need to resort to
JavaScript?? I want to do it exclusively using Java.

Can someone please help me? This is becoming frustrating!

Thanks for your help.

Mark Spezzano
valheru@chariot.net.au - 21 Feb 2008 04:27 GMT
It just occurred to me that maybe I need to use JSON-RPC??

It this correct? How would I go about doing this?

Mark


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.