Thanks very much for your help, which makes perfect sense.
In the WSDL I'm working with, I have soap faults defined like
wsdl:fault name=CERSErrorErr
soap:fault name=CERSErrorErr
use=literal/
/wsdl:fault
When I create and return one of those objects, it gets turned into the
correct exception and works beautifully. I do that by a throw
CERSErrorErr statement in my skeleton code and I don't have to do
anything else apart from set the properties. The
If I try and move the validation into the handler which is the best
place for it, I'm not able to do a throw CERSErrorErr as the handler
will only throw AxisFaults and the CERSErrorErr class extends
java.lang.Exception.
I realise I'm missing something pretty obvious - but can anyone suggest
what I need to do look at, to be able to throw my correct exceptions.
Thanks
From: Amila Suriarachchi [mailto:[EMAIL PROTECTED]
Sent: 28 February 2008 11:35
To: axis-user@ws.apache.org
Subject: Re: newbie confusion
On Thu, Feb 28, 2008 at 5:19 AM, Inman, Peter [EMAIL PROTECTED]
wrote:
I'm new to AXIS2, and I have to develop a web service which someone else
has supplied the WSDL, We also have to host a couple of operations as
well as make calls to them.
I have used WSDL2Java to generate the client code and service skeleton
and I have also deployed a service and put some debugging code in the
skeleton to verify that the methods can be called. SO far, all seems to
work ok.
With one particular operation, I have to validate the incoming SOAP
message against the schema using XMLBeand and either return a
CERSErrorDocument or a SOAPFaultException with details of the
exception in it. This is where my confusion starts.
I thought I would build a module (handler) and validate the SOAP message
here. This works fine and seems quite a tidy way of doing things.
The problem I'm having is - how do exceptions get out of the handler and
back to the client? Do I just throw them out of the handler?
you can throw AxisFaults from handlers. set the AxisFault details
element correctly. this will added to the soap fault details element.
Also - if the SOAP message is valid, I return an acknowledge
document, if it's invalid I return a SOAPFaultException - do I return
those out of the handler too?
No you can do this at the Skelton and send the throw an Exception. Here
set the exception message element correctly.
Where is the best place to handle this kind of thing? The
module(handler) seems quite tidy, but I'm obviously missing the bit of
information which tells me how exceptions are handled from modules.
Or - should I modify the MyServiceSkeleton.java class and put
the validation and logic in that.
Any advice would be appreciated.
Thanks,
Pete
--
Amila Suriarachchi,
WSO2 Inc.