It's all about the answers!

Ask a question

Exception serialization in ITeamModelledRestService


Vibha Sinha (1643610) | asked Sep 18 '08, 7:06 a.m.
Hi,

Whenever any service implementing ITeamModelledRestService, throws an exception, it is shown as following in my browser -


The server encountered an internal error () that prevented it from fulfilling this request.


I am using RTC 1.0 installed over tomcat.

How can I make the server returns back error details ?
Also, if I am writing my own service and throw an exception which I define, will Jazz component code take care of it's serialization ? What is the best method to return back error messages to the browser ?

Thanks
- Vibha

5 answers



permanent link
Todd Lainhart (40611) | answered Sep 18 '08, 11:27 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
vssinha wrote:
Hi,

Whenever any service implementing ITeamModelledRestService, throws an
exception, it is shown as following in my browser -

The server encountered an internal error () that prevented it from
fulfilling this request.

I am using RTC 1.0 installed over tomcat.

How can I make the server returns back error details ?
Also, if I am writing my own service and throw an exception which I
define, will Jazz component code take care of it's serialization ?
What is the best method to return back error messages to the browser
?

Thanks
- Vibha


Are you implementing a browser client (e.g. Dojo-based) to communicate
with your service, or are you using the browser to just get these error
diagnostics? Is your wire representation JSON?

Conventionally, Jazz web-based clients request the wire representation
of the server response as JSON, and read programmatically the error
information encoded as such.

There are some internal (i.e. unsupported) diagnostics that might help
you get data back to the browser for inspection. Add the following
query parameters to your URI in the browser's address bar (in addition
to the parameters that your service expects) and see if this helps:

?_mediaType=text/json&_asText=true&_prettyPrint=true

If you're lucky, you'll see some error information formatted as JSON in
the browser's page-rendering area.

--
Todd Lainhart
Jazz Repository/Foundation Team

permanent link
Vibha Sinha (1643610) | answered Sep 19 '08, 1:09 a.m.
Hello Todd,

I am using xml serialization.

Thanks
- Vibha

permanent link
Todd Lainhart (40611) | answered Sep 19 '08, 11:02 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
vssinha wrote:
Hello Todd,

I am using xml serialization.

Thanks
- Vibha


Diagnostic exception serialization in XML is not available at the
moment, unfortunately. Regardless, try what I previously suggested to
see if you can get additional information (using text/json). There's a
chance that you might get back some useful information.

--
Todd Lainhart
Jazz Repository/Foundation Team

permanent link
Vibha Sinha (1643610) | answered Sep 22 '08, 2:26 a.m.
Hello Todd,

We have our UI implemented in DOJO and it understands the XML serialization that is returned. It would be too much work to shift to text/json representation now.

Is there any other way I can return an error message back to the browser client ? I am ok not returning the whole exception trace but just a one line message or error code.

Thanks
- Vibha

permanent link
Todd Lainhart (40611) | answered Sep 22 '08, 9:54 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
I understand what you're saying.

I'm suggesting that you take the offending URI, put in into the address
bar of a browser (outside the context of your javascript app), append
the query parameters that I suggested, and observe the output in the
browser's window. This is not a programmable solution - just a
debugging trick to see if there are any server-generated messages that
you're missing..

If your server component is not in control of the exception, there is no
way for you to interject message into the exception.

There is currently no XML serialization of exception information in the
response. If this is something you'd like to see in a subsequent
release, please file an enhancement request against the respository
component.

vssinha wrote:
Hello Todd,

We have our UI implemented in DOJO and it understands the XML
serialization that is returned. It would be too much work to shift to
text/json representation now.

Is there any other way I can return an error message back to the
browser client ? I am ok not returning the whole exception trace but
just a one line message or error code.

Thanks
- Vibha



--
Todd Lainhart
Jazz Repository/Foundation Team

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.