GeeCON Prague 2014*
The moose likes Web Services and the fly likes web service using json in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Web Services
Bookmark "web service using json in java" Watch "web service using json in java" New topic
Author

web service using json in java

Anupa Nandi
Greenhorn

Joined: Apr 19, 2011
Posts: 4
Hi,

I have to develop a server side web service that will be consumed by an Iphone Application.

I have developed using SOAP and restful web service.But the problem is that when using SOAP I getting wsdl format xml which the client is unable to parse using TinyParser and for restful its wadl which is not support for Iphone aaplication.

Now the client want web service in json format.I have searched a lot in google but unable to get any relevant example from where I could find how to develop web service using json.

Please help me by giving any link where I could find an example or any help will be anticipated

Thanks in advance for your help,
Anupa
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42030
    
  64
I don't follow the remarks about WSDL and WADL; those are used to build the client code, not to run the client code. Thus, the iPhone app wouldn't have to parse it.

What, specifically, are you curious about regarding JSON? json.org will tell you all about the syntax, and point you to numerous libraries to create and parse JSON, including several written in Objective-C.


Ping & DNS - my free Android networking tools app
Anupa Nandi
Greenhorn

Joined: Apr 19, 2011
Posts: 4
Hi Ulf Dittmer ,

Thanks for reply.
I have to develop web service in java whose return type will be json, means the client will read this json to get the response of the request.

For example,
For login we need username and password.The client will call my webservice method by giving username and password as parameter .The method will return "login succesful" in json format.This is what my requirement.

Hope you get my problem this time.

Thanks
Anupa
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42030
    
  64
Check out the JAX-RS API for RESTful web services, particularly its Jersey implementation that runs as a Java web app. JAX-RS provides for various result types including JSON.
Anupa Nandi
Greenhorn

Joined: Apr 19, 2011
Posts: 4
Hi,
I am sorry to say I didnot get you properly.Will please be more precise?

Thanks
Anupa
Anupa Nandi
Greenhorn

Joined: Apr 19, 2011
Posts: 4
I have used JAXRS.
The problem with that is when I am using that I am getting wadl format link which is not supported by the Iphone Application as that is being developed in C.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42030
    
  64
You don't need to use WADL to create client code. It's easier that way, but not at all required. It's not like building a REST client is terribly difficult. I'm sure there are freely available REST libraries written in Objective-C.
 
GeeCON Prague 2014
 
subject: web service using json in java