Nice answer, thanks Guy. I will have need for some asynchronous requests** but this particular request (deleteEmployee) would definitely be synchronous.

** and I'm asuming that I can mix and match sycn and async in the same service, though I haven't yet worked out how to indicate that to java2wsdl, and suspect that I'll have to manually edit the generated wsdl.


From: Guy Rixon <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: Explicit response required from WS methods?
Date: Wed, 31 Aug 2005 17:15:26 +0100 (BST)

Hi,

void is fine, and saves a little parsing on the return. If it works, then the service returns an HTTP 200 with a SOAP body that doesn't need deserializing; the client stub returns quietly. If it goes wrong, then the client stub chucks
an Exception in which the detail states the HTTP status-code.

Architecturally, there's a deeper point. Suppose that your service could
return an HTTP 200 with no body; i.e. suppose you could implement a one-way
operation which Axis 2 supports and Axis 1 doesn't. Would this be a good
equivalent to a method returning void? Yes, in the sense that less XML
handling would be involved. No, in the sense that the 200 might come back
before the service had processed the request; i.e. the work would be
asynchronous. An asynchronous request to a service is not a good match to a
method returning void.

On Wed, 31 Aug 2005, Jarmo Doc wrote:

> Let's say that I have a WS method like so:
>
>   deleteEmployee(int empid) throws SOAPException
>   {
>   }
>
> Is it sensible for this method to have a void return type or should it
> always return something, for example the empid just deleted (for client
> correlation purposes, amongst other things)?
>
> I ask because it's not clear to me what's going on under the covers.  I
> could imagine, for example, that void would be OK because any kind of
> problem explicitly detected by the web service method would throw a
> SOAPException and any kind of network issue (e.g. request not even making it > to the web service) or a failure of the service to execute the method might
> cause the underlying infrastructure itself to throw a SOAPException
> (because, for example, HTTP 200 OK was never seen by the client). So the
> absence of a SOAPException might reasonably imply success and hence no
> return type was required.
>
> Thanks.
>
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search!
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>

Guy Rixon                                       [EMAIL PROTECTED]
Institute of Astronomy                          Tel: +44-1223-337542
Madingley Road, Cambridge, UK, CB3 0HA          Fax: +44-1223-337523

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Reply via email to