Skip to main content

JSON Web Services

4 replies [Last post]
Joined: 2008-11-02

Hi All,

I am curious about JSON web services. How to create, deploy and consume a JSON web service in glassfish?

Thank you,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-11-02

Thank you very very much.

I am OK now.

Joined: 2008-11-02

Thanks a lot.

Is the rest and json are same?

Paul Sandoz


See the following Jersey sample:

and the following tech tip:

JSON and REST are not the same.

JSON is a data format that is a subset of the JavaScript language and
as a result the format is very easy to produce and consume by
JavaScript programs e.g. those running in Web browsers. But it can
also be for JavaScript servers like Phobos.

REST is an architectural style that declares constraints. If those
constraints are applied to your architecture then it induces certain
desirable properties, like loose coupling or scalability, which are
important when building applications for the Web.

The relationship between JSON and RESTful Web applications is as
follows: Resources, identified by URLs, produce and consume
representations when a client makes a request using an HTTP method.
The representations are identified by a media type, which describes
what the representation is. Such a representation may be a JSON
document and might be identified by the media type "application/json".
JSON is just one of many data formats you may choose to use in your
Web application.

Hope that helps,

On Nov 7, 2008, at 3:21 AM, wrote:

> Thanks a lot.
> Is the rest and json are same?
> [Message sent by forum member 'farazali' (farazali)]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

Joined: 2008-10-22

For developing JSON webservices (RESTful webservices), Jersey could be used on glassfish. Please check this link ( for developing and deploying sample applications using Jersey on glassfish.The output format could be specified as JSON or XML.

To consumer the webservice,
i) from the command line, curl could be used
ii) from a web application, an XmlHttpRequest is to be created and sent.
The response in JSON format could be handled by the callback methods. Javascript libraries like jQuery or the jMaki toolkit (that is available as a Netbeans plugin as well) could be used to simplify the handling of XHR and the response.