axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pushkin Reddy" <push...@gmail.com>
Subject Axis2 - Fault Inheritance
Date Mon, 05 May 2008 07:59:44 GMT
Hi,

I'm trying to use a contract first approach with Axis2 (1.3/1.4) to handle a
fault hierarchy scenario. As a test, I used the following WSDL with
WSDL2Java to generate stubs for a service with a simple method that throws a
BaseFault exception. It also contains a definition for DerivedFault as a
subclass of BaseFault. I don't see an exception class generated for
DerivedFault nor any way in which I can throw the DerivedFault in the
service implementation. What am I missing here? (The same WSDL processed
with WSDL2Java from Axis 1.4 outputs exception classes for both faults
correctly).

Thanks!
Pushkin

EXAMPLE.WSDL:
=============

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://example"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    xmlns:tns="http://example"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <wsdl:types>
      <schema elementFormDefault="qualified" targetNamespace="http://example"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="
http://xml.apache.org/xml-soap" xmlns:tns="http://example" xmlns:intf="
http://example" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

         <element name="methodRequest">
            <complexType>
               <sequence/>
            </complexType>
         </element>

         <element name="methodResponse">
            <complexType>
               <sequence/>
            </complexType>
         </element>

         <complexType name="BaseFaultType">
            <sequence/>
         </complexType>

         <complexType name="DerivedFaultType">
            <complexContent>
               <extension base="tns:BaseFaultType">
                  <sequence/>
               </extension>
            </complexContent>
         </complexType>

         <element name="BaseFault" type="tns:BaseFaultType"/>
         <element name="DerivedFault" type="tns:DerivedFaultType"/>
      </schema>
   </wsdl:types>

   <wsdl:message name="methodRequestMessage">
      <wsdl:part element="tns:methodRequest" name="parameters"/>
   </wsdl:message>

   <wsdl:message name="methodResponseMessage">
      <wsdl:part element="tns:methodResponse" name="return"/>
   </wsdl:message>

   <wsdl:message name="BaseFaultMessage">
      <wsdl:part element="tns:BaseFault" name="fault"/>
   </wsdl:message>

   <wsdl:message name="DerivedFaultMessage">
      <wsdl:part element="tns:DerivedFault" name="fault"/>
   </wsdl:message>

   <wsdl:portType name="Example">
      <wsdl:operation name="method">
         <wsdl:input message="tns:methodRequestMessage"
name="methodRequest"/>
         <wsdl:output message="tns:methodResponseMessage"
name="methodResponse"/>
         <wsdl:fault message="tns:BaseFaultMessage" name="BaseException"/>
      </wsdl:operation>
   </wsdl:portType>

   <wsdl:binding name="ExampleSoapBinding" type="tns:Example">
      <wsdlsoap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="method">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="methodRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="methodResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
         <wsdl:fault name="BaseException">
            <wsdlsoap:fault name="BaseException" use="literal"/>
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>

   <wsdl:service name="ExampleService">
      <wsdl:port binding="tns:ExampleSoapBinding" name="Example">
         <wsdlsoap:address location="http://localhost/services/example"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

================

Mime
View raw message