Tuesday, November 21, 2006

ActionWebService question

How do I create and return fault messages from the class implementing the web service API? Do I just raise my own exceptions, and the runtime takes care of the rest?

I tried to figure this out by invoking my web service from a) a WSIF dynamic invoker sample class and b) from Ruby's own SOAP client. In the first case I hit a WSIF exception, and I was not sure whether the problem was with the WSIF code or with the way I was just throwing my exception without doing anything, well, SOAPy with it. In the second case, the exception was simply propagated along the SOAP client's call stack. Oh, and using the 'invoke' scaffolding option just throws the runtime error in the browser [*].

The RoR documentation needs to be a lot more organised. I see something like api_method in the ActionWebService::API:Base class, and go to the documentation page, hoping to figure out an answer to my question. Instead, I find that I can't even locate the class there. Throw in modules and mixins, and I don't even know where I should be looking. JDK documentation it sure ain't.

[*] Come to think of it, all successful calls to web service methods using the 'invoke' option produce nice SOAP response XMLs, so if I were doing things correctly, even the error scenario should have produced a response XML, albeit with a fault message (Update: I was wrong; it does).