axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruslan.Ze...@ubs.com
Subject RE: (Chained) Exceptions and beanMapping
Date Wed, 13 Nov 2002 15:41:06 GMT
Steve,

Sorry if my message sounded negative to you in any way.
I did not mean to do it.

I'm fully aware that Web Services are designed for interoperation among
different platforms and languages.
However, JAX-RPC has specified that this WS method can generate Fault
events. The information of how it is handled by implementation is very
ambiguous. So, I think it is up to AXIS team to implement proper
handling if FAULTS. Am I wrong?

Particularly I want to achieve Fault processing/handling similar to
Complex type processing/handling.
AXIS has a way (in wsdd) to register (typeMapping) custom
serializer/deserializer for parameter.

e.g.
  <typeMapping deserializer="com.acme.MyBeanDeserializer"
encodingStyle="" qname="ns3:TPerson"
serializer="com.acme.MyBeanSerializer" type="java:com.acme.TPerson"
xmlns:ns3="http://acme.com"/>

Should it be the same for FAULT typeMapping?

For example I have the following WSDL declaration:
<wsdl:types>
 <xsd:complexType name="TException">
  <xsd:sequence>
   <xsd:element name="message" nillable="true" type="xsd:string" />
   <xsd:element name="errCode" nillable="true" type="xsd:int" />
   <xsd:element name="errDetail" nillable="true" type="xsd:string" />
  </xsd:sequence>
 </xsd:complexType>
 <xsd:element name="Exception" nillable="true" type="impl:TException"/>
</wsdl:types>
...
<wsdl:message name="methodException">
 <wsdl:part element="intf:Exception" name="fault"/>
</wsdl:message>
...
<wsdl:portType name="EdenService">
 <wsdl:operation name="method1" parameterOrder="param">
  <wsdl:input message="intf:method1Request" name="method1Request"/>
  <wsdl:output message="intf:method1Response" name="method1Response"/>
  <wsdl:fault message="intf:methodException" name="methodException"/>
</wsdl:operation>

then in wsdd file similarly to parameter typeMapping:
-------------------
  <typeMapping deserializer="com.acme.MyBeanExceptionDeserializer"
encodingStyle="" qname="intf:TException"
serializer="com.acme.MyBeanExceptionSerializer"
type="java:com.acme.TException" xmlns:intf="http://acme.com"/>

When I tried this, it did not pick up my custom typeMapping. Looks like
it works only for wsdl:input / wsdl:output. Why not for wsdl:fault?
Again, am I doing something wrong here?

So, as you can see I'm trying to define ComplexType for SOAP Fault.
In WSDL I describe my exception's fields.
However, AXIS generated stubs does not serialize Exception's fields into
SOAP Fault object

Also, I noticed if web service method throws exception not derived from
AxisFault it DOES NOT serialize its fields (even if it follows JavaBean
spec). SHOULDN'T it be changed?

What would you suggest in the situation like this? I don't want to end
up with RE-ENCODING all my Java exceptions into AXIS specific class
AxisFault - this would lock me into AXIS specific implementation.
Should be more elegant way of doing this...

regards,
Ruslan Zenin
http://www.geocities.com/russ_zenin



-----Original Message-----
From: steve.l 
Sent: November 12, 2002 7:11 PM
To: steve.l; axis-user
Subject: Re: (Chained) Exceptions and beanMapping
----- Original Message -----
From: Ruslan Zenin
To: <axis-user@xml.apache.org>
Sent: Tuesday, November 12, 2002 1:42 PM
Subject: RE: (Chained) Exceptions and beanMapping


>Can anyone explain clearly WHY developers are forced
>to inherit from AxisFault class?

>It is a huge problem with the AXIS product. The reality is that
>lots of developers adding WEB Services to EXISTING applications.

You are thinking about it wrong. At least, you are if you are trying to
turn
SOAP into a kind of RMI-over-XML.

The purpose of SOAP is interoperable web services, and that includes
callers
using C++, Perl, C, Prolog, C# ...

That means
-languages that dont have exceptions
-languages that dont have java's 'you must declare all exceptions rule'

Over the wire, exceptions become soapfaults, which have a fixed
structure, a
structure which includes an XML fragment. But what that far end makes of
it,
is up to the far end. For many languages, it just becomes some XML they
get
to look at.

JAX-RPC has this wierdness that says a java.rmi.RemoteException can be
marshalled provided it has a constructor with a named parameter for each
of
the beans that get marshalled. So it is a) a fixed parent and b) an
odder
way of deserializing than any other (I guess it allows immutable
exceptions). And that is a JCP spec, not an Axis spec, so dont blame us.
NB:
I dont know how well JAX-RPC exceptions are handled in Axis.


Here is what .net does:
http://msdn.microsoft.com/webservices/default.aspx?pull=/library/en-us/d
nser
vice/html/service09172002.asp

Scott Seely is the only MS employee I've seen bulding Java code during a
demo, even if he did use .vbs to build it rather than ant (we heckled
him)

>And there is no way to change existing exceptions nor register custom
>serializer/desirializer.

>AXIS should not be so strict about exceptions. It should at least have
>an INTERFACE instead of a class

There is some validity in what you say. Meaning that there could be some
'getExceptionXML' interface that gets the XML for the exception. But the
other trick is to have a try/catch handler in your own endpoints that
create
AxisFaults from your own faults and fills in the appropriate exceptions.
That doesnt help you at the far end, but as I've explained, all they get
at
the far end is a SoapFault.

>In my case I becomes a showstopper to use AXIS at all, since it can't
>properly serialize my CustomExeptions at the moment.

1. you are free to correct axis as you see fit.
2. I think if you are trying to web-service-ize an existing app and
expecting an RMI or EJB API to suddenly become a web service you are
going
to be disappointed, regardless of the web service framework you are
using.

Can you tell us more about 'the problem' and your app as it exists so
far?

-steve




Mime
View raw message