Thanks very much for the good idea. If I understand you, every object that your operations return would be derived from (or explicilty include) TestServiceResponse. If so then that would have a big impact on my WSDL (which right now has operations that return arrays of objects, single objects, and even void in some cases).

Having said that, if I don't get exceptions working very soon then I may think seriously about your idea. Thanks for taking the time to help.


From: iksrazal <[EMAIL PROTECTED]>
Reply-To: axis-user@ws.apache.org
To: axis-user@ws.apache.org
Subject: Re: Exceptions are killing me
Date: Thu, 12 Jan 2006 17:19:26 -0200

You know, I often see people banging their head against a wall when it comes to Exceptions and SOAP. So let me give you a hint that has worked splendidly
for me over several projects: Don't even use them. Return an error code and
message, generated in your try / catch block.

Allow the code to explain ( axis2, but I've used the idea in both axis 1.x and
Sun's JWSDP):

 public  TestServiceResponseDocument testService(
            TestServiceDocument testServiceDocument) {
   // prepare output
        TestServiceResponseDocument retDoc =
            TestServiceResponseDocument.Factory.newInstance();

        TestServiceResponse retElement =
            TestServiceResponse.Factory.newInstance();
                    TestService testService =
testServiceDocument.getTestService();
            String soapSessionId = testService.getSoapSessionId();
            String webUserName = testService.getWebUserName();
        try {

            if (!authenticator.validateSoapSessionId(soapSessionId,
                    webUserName)) {
                wiseMobilAdapter.handleDefaultTimeout(retElement,
webUserName);
            } else {
                wiseMobilAdapter.testService(retElement);
            }

        } catch (Exception ex) {
            logger.error("SWAWiseEndpointSkeleton.testService:"
                    + ex.getMessage(), ex);
            retElement.setErrorMessage(ex.getMessage());
            retElement.setSuccessErrorCode(MessagesCodes.FAILURE);
        }
        retDoc.setTestServiceResponse(retElement);
        return retDoc;
    }

The idea here is retElement is passed in to the adapter, which sets the pass /
fail status and any other variables needed to return. Or, the try catch in
the skeleton does the error handling in case of session timeout, login
problems etc.

[snip]

_________________________________________________________________
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