Hi Sunil,
I've gone the way you suggested, and you are completely right.
Given MyException (service imlpementation), Axis generates its own MyException to be throws by the stub.
Thus, when I try catch MyException, I am actually catching Axis's MyException.
All the fuzz comes from trying to provide original implementations of the WSDL types, custom Exceptions included.
The reason is simple: I want to provide the clients worthy object. Axis's code generated do not provide originals' funcionality.
Therefore, I replaced Axis'.
This got to do with interoperability, right? I cannot expect any client accesing my webservice to have objects with the same
functionality I have in my own impl. Therefore, objects through the wire become merely data structures.
I defnitely have original implementation working on the client side when it's about a parameter object. Axis deserializes it into
my classes with no problem. That way I have the same implementations in both server and client.
I was hoping for Exceptions to be treated the same way. Good lord, foolish me.
In this particular case MyException was providing some i18n services, such as passing a key and getting it from a client-desicion
property bundle, releasing the stub user to get the key and searching it by its own.
There, all said. Thanks to all and apologies to those bothered by the many mails.
Mariano Eloy Fern�ndez.
Sunil Kothari wrote:
Hi Mariano,
Just to add further .... we had problem in catching custom exceptions by .NET clients although Axis generated java clients worked fine. I think for .NET clients one has to do low-level job of handling XML and parsing it and then be able to get at the details of exception.
Mariano, I still think WSDL is the ONLY thing that is needed and as far as I know AXIS automatically subclass custom exceptions from AxisFaults.
The point is all custom exceptions get wrapped up as AxisFaults.
Another point custom exceptions are a known problem with DII clients. Initially, we tried with DII but then realised that its a problem and moved on to stubs approach and it worked.
Sunil Kothari
----- Original Message -----
From: Mariano Eloy Fern�ndez <[EMAIL PROTECTED]>
Date: Wednesday, February 23, 2005 3:16 pm
Subject: Re: How do I deserialize the detail field in AxisFault to build MyException?
Hi Sunil,
Thanks for the harping, I really need it to get it straight.
This is what I understand, though I may not be well.
The classes generated from the WSDL types are for the following scenario:You want to access a web service, published with a different framework, say,
(everybody hold on tight and say aughhh) .NET (auughh). Hey, I heared a Doh! over there.
Enter Axis, generate client stub and classes for the types from the WSDL provided.
All well, that's all right, becouse you need these type classes as you don't have the original ones.
But say the service operation op1() throws OpException.
How, in the name of Christina Aguilera, do we catch OpException when using the stub client provided by Axis?
Now we are sure, plenty sure, that the developer that decided to throw OpException did not subclass AxisFault, did he?
So, how will Axis's stub client throw OpException when suitable?
I felt this topic was over when I received your response and that I shuold not harper further.
But I am not satisfied and you know me.....
Best wishes,
Mariano.
Sunil Kothari wrote:
Hi Mariano,correctly
Sorry for harping on the same point. I think if I get you
then you will have to use generated classes and throw away YOURclasses
(classes used to generate WSDl). WSDL contains everything.........so
its all up to the framework to make sense of fault andfaultdetails and
generate classes accordingly.suppose) to
If you want to make changes then make changes(additions I
toAxis generated classes.
I hope that helps and gets you exceptions with details :)
Sunil Kothari
----- Original Message -----
From: Mariano Eloy Fern�ndez <[EMAIL PROTECTED]>
Date: Wednesday, February 23, 2005 2:42 pm
Subject: Re: How do I deserialize the detail field in AxisFault
itbuild MyException?
Hello,
MyException is declared correctly, i think. Here's the WSDL segment.
<complexType name="MyException">
<sequence>
<element name="clave" nillable="true" type="xsd:string"/>
<element name="localizedMessage" nillable="true" type="xsd:string"/> </sequence>
</complexType>
......
<wsdl:fault name="MyException">
<wsdlsoap:fault use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="someUri"/>
</wsdl:fault>
Yes, I guess I am using Axis the normal way. Interface -->WSDL--
stubsand skeletons.
I am using axis both for publishing the service and for calling
typesfrom
the stub client.
However, I am getting rid of the classes generated from the
havein WSDL.
Why? Because I already have them. They are the same classes I
but,on the server, including
MyException. Sure, I could use MyException generated by Axis,
MyExceptionwhy, having the original MyException class?
My goal is to make the stub client throw instances of
making(my implementation of MyException)
transparently, not letting the ones using the stub provided by Axis know anything else.
A different thing is Axis not supporting what i need, say,
isme subclass AxisFault, which I stated I'll try to avoid.
However, if everything else fails, well....
Thanks again Sunil.
Mariano.
Sunil Kothari wrote:
Let me elaborate further. I think if your exception structure
picturedeclared correctly in WSDL then the framework comes into
wayonly
when you generate java/.NET server/client code from it.
When I say subclass AxisFault I assume that you go the normal
AxisFault,of
generating a java interface ---> WSDL ---> stubs and skeletons.based
and you use only Axis all the way.
I think its your "framework" which has to generate correct code
on WSDL. When I say subclass AxisFault I mean if you use Axisthen
thatthat's the way.
If you want to get hold of XML and use a handler then I think
toshould work too.
Sunil Kothari
----- Original Message -----
From: Mariano Eloy Fern�ndez <[EMAIL PROTECTED]>
Date: Wednesday, February 23, 2005 2:14 pm
Subject: Re: How do I deserialize the detail field in AxisFault
build MyException?
Hello,
Thanks Sunil, I have already seen people subclassing
frameworkbut I refuse doing such a thing.
MyException is a "ServiceException", and should know anything about being published with Axis.
Imagine just tomorrow I decide to move onto some other
onFrameworkFault?to publish/call Web Services.
Then what, should I subclass some other different
Of course not.
My idea is to get grip of that XML provided in the AxisFault
yourthe client Stub, unwrap MyException and throw it,
so that the stub throws true MyException instances (or RemoteExceptions, if some ConnectRefused-like occurs)
In all, I�ll keep on trying, and thanks a lot for your comment.
Mariano.
Sunil Kothari wrote:
No, you don't have to do it manually. Just make sure that
thatWSDL
correctly reflects the structure of MyException. I found thatjava2wsdl
tool somehow misses the structure of application-specificexceptions.
To get hold of the exception use try-catch mechanism. Note
sendMyException should subclass AxisFault.
If you still have problems then let me know so that I can
AxisFaultyou a
sample code.
I hope that helps.
Sunil Kothari
----- Original Message -----
From: Mariano Eloy Fern�ndez <[EMAIL PROTECTED]>
Date: Wednesday, February 23, 2005 1:45 pm
Subject: Re: How do I deserialize the detail field in
anAxisFault?>>>>to
build MyException?
Hi,
Some additional notes.
The XML comes in a protected attrbute called faultDetails, inaccesible.The public detail field is null.
The question stands, How do I build MyException from this
WebThanks,
Mariano.
Mariano Eloy Fern�ndez wrote:
Hello,
I am working with Axis 1.1
I have a class MyException extends Exception thrown in the
Service. Both De/Serializer are provided for MyException.
An AxisFault is received in the client with MyException as
itXML in
the detail field of AxisFault.
How do I build MyException from that XML? Do I have to do
manually?
Then what's the MyExceptionDe/Serializer for?
Thanks,
Mariano Eloy Fern�ndez.
