You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mitch Gitman <mg...@usa.net> on 2002/11/19 00:16:54 UTC

Re: [want exceptions in Java interface]

Well, I wound up working around the Axis tools’ taking exception to
Exception. I stripped the unwanted byproducts of java.lang.Exception from the
WSDL that Java2WSDL had generated. Then WSDL2Java worked just fine. I guess I
will just incorporate this editing of the .wsdl into my build.

Still, there must be a more elegant solution. Something so basic as throwing
an Exception in your Java interface should not require a workaround. Perhaps
someone else on this list has had a similar experience.


Mitch Gitman <mg...@usa.net> wrote:
I have a minimal Java interface that I want to expose as a web service. 
Most of the methods in this interface throw a custom exception derived from
Exception. Ultimately, through my RPC web service, I want these exceptions to
translate into SOAP faults. My understanding is that I don't have to be
introducing AxisFault or SOAPFault objects into this interface.

When I run Java2WSDL, I get the following warning messages:
Nov 16, 2002 5:55:08 PM org.apache.axis.wsdl.fromJava.Types isBeanCompatible
WARNING: The class java.lang.Throwable is defined in a java or javax 
package and cannot be converted into an xml schema type.  An xml schema 
anyType will be used to define this class in the wsdl file.
Nov 16, 2002 5:55:08 PM org.apache.axis.wsdl.fromJava.Types isBeanCompatible
WARNING: The class java.lang.StackTraceElement is defined in a java or 
javax package and cannot be converted into an xml schema type.  An xml 
schema anyType will be used to define this class in the wsdl file.

Then I run WSDL2Java on the WSDL file just generated. It fails abruptly 
with the following exception:
java.io.IOException: Type {http://www.w3.org/2001/XMLSchema}null is 
referenced but not defined.
         at 
org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:484)
         at 
org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:384)
         at 
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:371)
         at 
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:358)
         at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:243)
         at java.lang.Thread.run(Thread.java:536)

It appears that an array of StackTraceElements, as inherited from  Exception's
interface, winds up as an array of nulls.

What should I be doing differently? Note: I'm using the release Axis 1.0. 
Thanks.

Here are the suspicious passages in the generated WSDL:
<complexContent>
____<extension base="tns3:KeyedException">
________<sequence>
____________<element name="cause" nillable="true" type="xsd:anyType" />
____________<element name="localizedMessage" nillable="true" 
type="xsd:string" />
____________<element name="stackTrace" nillable="true" 
type="impl:ArrayOf_tns4_StackTraceElement" />
________</sequence>
____</extension>
</complexContent>
..
<complexType name="ArrayOf_tns4_StackTraceElement">
____<complexContent>
________<restriction base="soapenc:Array">
____________<attribute ref="soapenc:arrayType" wsdl:arrayType="null[]" />
________</restriction>
____</complexContent>
</complexType>