At line number 3, it throws an exceptiona and lands in throwable block.
Now I don't understand how and why it is working for you,...because the variable msg is null at that time and I won't be able to invoke writeTo method on it, as it'll definitely give me a null pointer exception.
Are you sure that the XML that you have sent is mal-formed?
Would it be possible for you to post the XML that was sent?
You can remove any one closing tag from the XML that you are sending (that way the XML will be mal-formed).
I desperately need this, because client will be sending thousands of requests in a day. And at the end of the day he may come up and ask, which and how many requests failed.
I will be able to answer him, only when I will have the XML recorded somewhere (when it was malformed, so that he can recognize and send it again).