aspose file tools*
The moose likes Web Services and the fly likes Returning Custom data type from a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Returning Custom data type from a web service" Watch "Returning Custom data type from a web service" New topic
Author

Returning Custom data type from a web service

Karthik Mohan
Greenhorn

Joined: Sep 29, 2004
Posts: 23
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

Joined: Sep 17, 2001
Posts: 548
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 ...


RR Kumaran
SCJP 1.4
Karthik Mohan
Greenhorn

Joined: Sep 29, 2004
Posts: 23
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

Joined: Mar 16, 2001
Posts: 986

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.


Please ignore post, I have no idea what I am talking about.
 
Consider Paul's rocket mass heater.
 
subject: Returning Custom data type from a web service