sending XML data in servlet response on http error & customizing http error msg
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Asp_P123
Posted On:   Friday, December 21, 2001 07:00 AM

Hi, I need suggestions/advice from the Guru's on the following: I have XML data coming over Http on to my 1st server, this server would validate the data and then depending on some criteria will open a url connection to the 2nd server. The 2nd server will perform business logic and send back the updated xml data. Now, incase i have errors (Database down or null pointer....etc) on the 2nd server which my servlet will catch. How should this servlet return error and xml document(if also required to be passed) to the 1st server and the 1st server to the requestor. What i am doing is : IN the 2nd servlet i say res.sendError(900, exception.getMessage()) 1.) Will i have   More>>

Hi,

I need suggestions/advice from the Guru's on the following:

I have XML data coming over Http on to my 1st server, this server would validate the data and then depending on some criteria will open a url connection to the 2nd server.

The 2nd server will perform business logic and send back the updated xml data.

Now, incase i have errors (Database down or null pointer....etc) on the 2nd server which my servlet will catch. How should this servlet return error and xml document(if also required to be passed) to the 1st server and the 1st server to the requestor.



What i am doing is :
IN the 2nd servlet i say
res.sendError(900, exception.getMessage())

1.) Will i have any problem using my own error code i.e "900". I use this so that i can differentiate on the 1st server the App Server error from my application generated errors.

2.) Even using this the 1st server doesn't receive the errorMessage in httpConn.getResponseMessage()only the correct Response code is returned (i.e 900).

3.) so i pass the error message in the response Header to the 1st servet. What will be maximum limit of the error mesage if passed in the header.

4.) Since i use the sendError()/setStatus() i think i will not get the data from the InputStream in 1 servlet, as the socket is already closed. So how would i get the XML data on the 1st server


Is there any better approach please suggest.



Thanks,
Asp

   <<Less
About | Sitemap | Contact