Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning Custom data type from a web service

 
Karthik Mohan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,

I am returning a custom data type from my webservice. At the same time when there is an error in the business process, I need to return an error message which is not part of the Response (custom data type).

How do i deal with this situation, and how can i implement this ? (My response data type and the error message format are different). I am using weblogic, so my serialization classes are generated by weblogic tools.

I tried setting the return type of my webservice to be java.lang.object and on my client side appropriately typecast it, but when i receive the response back on my client side, a serialization error is raised.

TIA
karthik
 
Rr Kumaran
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you dont need to handle error messages seperately and since all server side exceptions are translated as AxisFaults to the client, we can have an handler on the client side that can format that AxisFault to a more user friendly error message or wrap it around an object of your choice ...
 
Karthik Mohan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
our specifications have custom error messages and error numbers. So i need to return custom error messages. Also i am using weblogic and not Axis.

Thanks
karthik
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WS and SOAP have error processing built it. You should make use of the existing tools to solve your problems. SOAP Faults writeup
Tags include: faultcode, faultstring, faultactor, and detail.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic