• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

truncated XML when axis2 service method throws an error

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks.

Running axis2 1.1.1 here. When a service method throws an exception on the server, the resulting XML in the response is truncated, which results in a ParseException on the client side. I have no idea why this is happening; tried to update to latest version of axis2, but that cause other issues...

Here is my services.xml:




Here is what ends up on the wire as the axis2 response:




As you can see, it is truncated. Has anyone seen this before? Any ideas?

Thanks!
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't say what kind of ideas you're looking for. Personally, I wouldn't be surprised that if the host threw an exception in the middle of producing an XML document, that you would then receive the part of the XML document that it had already sent your way.

But basically that's irrelevant. If the client doesn't get an OK response from the web service, then it shouldn't be attempting to process the output anyway. And if you are notified that there was an error on the server, it would be polite to notify the owners of the server that errors are happening there.
 
Jeff Harbinson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:You don't say what kind of ideas you're looking for. Personally, I wouldn't be surprised that if the host threw an exception in the middle of producing an XML document, that you would then receive the part of the XML document that it had already sent your way.

But basically that's irrelevant. If the client doesn't get an OK response from the web service, then it shouldn't be attempting to process the output anyway. And if you are notified that there was an error on the server, it would be polite to notify the owners of the server that errors are happening there.



The server should return a 500 status code - I believe that's the correct behavior. But, the XML returned should be valid. I think axis2 is blowing up internally while assembling the response. The client needs to be able to parse the response to see what the cause of the error was.

Thanks.
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeff Harbinson wrote:The server should return a 500 status code - I believe that's the correct behavior. But, the XML returned should be valid. I think axis2 is blowing up internally while assembling the response. The client needs to be able to parse the response to see what the cause of the error was.



Ah yes, good point. But if the server fails to do so, that's the server's problem, no? I don't see there's much you can do about it except notify the owners of the server.
 
Jeff Harbinson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Jeff Harbinson wrote:The server should return a 500 status code - I believe that's the correct behavior. But, the XML returned should be valid. I think axis2 is blowing up internally while assembling the response. The client needs to be able to parse the response to see what the cause of the error was.



Ah yes, good point. But if the server fails to do so, that's the server's problem, no? I don't see there's much you can do about it except notify the owners of the server.



The owner of the server would be me. :D

We are actually the authors of the client and the server; I need to try to get the server to return valid XML. I'm wondering if this is a misconfiguration or misuse on my part, or a bug in axis2. If a bug in axis2, is it something that can be worked around?

Thanks.
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, so the next step is to find out what happened on the server. Logs? Stack traces? The client side isn't telling you much, you're going to need information from the server.
 
Jeff Harbinson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Okay, so the next step is to find out what happened on the server. Logs? Stack traces? The client side isn't telling you much, you're going to need information from the server.



I'm away from the server at the moment, so I can't provide the complete stack trace. But, axis2 is throwing an InvocationTargetException, which wraps the Exception that I'm throwing in my service method.
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. It definitely helps that you own the server.

One thought comes to mind. Instead of having the service throwing an exception, you could try modifying the service to construct and return a SOAP fault where the exception occurs. You should then get back a valid XML.
 
Jeff Harbinson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

R Srini wrote:Hi. It definitely helps that you own the server.

One thought comes to mind. Instead of having the service throwing an exception, you could try modifying the service to construct and return a SOAP fault where the exception occurs. You should then get back a valid XML.



I've tried doing this, although I used an AxisFault. It didn't solve the problem.
 
Jeff Harbinson
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the full stack trace:

 
reply
    Bookmark Topic Watch Topic
  • New Topic