You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Joel_Turkel <Jo...@alumni.brown.edu> on 2008/03/19 00:58:56 UTC
Generated Faults and Inheritance
Hi,
Is there anyway to get CXF to generate an inheritance hierarchy of users
defined exceptions? For example, I'd like to generate something like the
following from a WSDL:
public interface Greeter {
public void pingMe() throws PingMeSubclassFault, PingMeFault;
}
where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault are
not related via inheritance. The actually WSDL I'm working with has a rich
hierarchy of exception so the lack of exception inheritance makes the
generated code hard to work with.
Thanks,
Joel
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloWorld"
targetNamespace="http://apache.org/hello_world_soap_http"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://apache.org/hello_world_soap_http"
xmlns:x1="http://apache.org/hello_world_soap_http/types"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema
targetNamespace="http://apache.org/hello_world_soap_http/types"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://apache.org/hello_world_soap_http/types"
elementFormDefault="qualified">
<element name="pingMe">
<complexType />
</element>
<element name="pingMeResponse">
<complexType />
</element>
<element name="faultDetail" type="tns:faultDetail" />
<complexType name="faultDetail">
<sequence>
<element name="minor" type="short" />
<element name="major" type="short" />
</sequence>
</complexType>
<element name="subclassFaultDetail">
<complexType>
<complexContent>
<extension base="tns:faultDetail">
<sequence />
</extension>
</complexContent>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="pingMeRequest">
<wsdl:part name="in" element="x1:pingMe" />
</wsdl:message>
<wsdl:message name="pingMeResponse">
<wsdl:part name="out" element="x1:pingMeResponse" />
</wsdl:message>
<wsdl:message name="pingMeFault">
<wsdl:part name="faultDetail" element="x1:faultDetail" />
</wsdl:message>
<wsdl:message name="pingMeSubclassFault">
<wsdl:part name="faultDetail" element="x1:subclassFaultDetail" />
</wsdl:message>
<wsdl:portType name="Greeter">
<wsdl:operation name="pingMe">
<wsdl:input name="pingMeRequest"
message="tns:pingMeRequest" />
<wsdl:output name="pingMeResponse"
message="tns:pingMeResponse" />
<wsdl:fault name="pingMeFault" message="tns:pingMeFault" />
<wsdl:fault name="pingMeSubclassFault"
message="tns:pingMeSubclassFault" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="pingMe">
<soap:operation style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
<wsdl:fault name="pingMeFault">
<soap:fault name="pingMeFault" use="literal" />
</wsdl:fault>
<wsdl:fault name="pingMeSubclassFault">
<soap:fault name="pingMeSubclassFault" use="literal" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SOAPService">
<wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
<soap:address
location="http://localhost:9000/SoapContext/SoapPort" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
--
View this message in context: http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16133913.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Generated Faults and Inheritance
Posted by Benson Margulies <bi...@gmail.com>.
1) Build code-first with Aegis.
2) Run java2ws from 2.1 with the Aegis databinding.
3) Use that WDSL as your starting point.
Warning: while I've worked on the code that supports all of this, I've never
looked closely at what come out of it.
On Fri, Mar 21, 2008 at 11:24 AM, Joel Turkel <Jo...@alumni.brown.edu>
wrote:
>
> Is there anyway to do this using WSDL first development?
>
>
> Benson Margulies-4 wrote:
> >
> > Aegis allows you to declare a base class in the throw clause and deliver
> > specific subclasses based on the actual class thrown. All the classes in
> > question end up in the wsdl.
> >
> >
> >
> > On Fri, Mar 21, 2008 at 9:41 AM, mikem2005 <mi...@gmail.com> wrote:
> >
> >>
> >> I'm trying to do the same thing...does anyone know if hierarchical
> >> exceptions
> >> are possible with CXF?
> >>
> >> Thanks!
> >> Mike
> >>
> >>
> >>
> >>
> >> Joel Turkel wrote:
> >> >
> >> > Hi,
> >> >
> >> > Is there anyway to get CXF to generate an inheritance hierarchy of
> >> users
> >> > defined exceptions? For example, I'd like to generate something like
> >> the
> >> > following from a WSDL:
> >> >
> >> > public interface Greeter {
> >> >
> >> > public void pingMe() throws PingMeSubclassFault, PingMeFault;
> >> >
> >> > }
> >> >
> >> > where PingMeSubclassFault is a subclass of PingMeFault. The WSDL
> below
> >> > doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
> >> are
> >> > not related via inheritance. The actually WSDL I'm working with has a
> >> rich
> >> > hierarchy of exception so the lack of exception inheritance makes the
> >> > generated code hard to work with.
> >> >
> >> > Thanks,
> >> > Joel
> >> >
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <wsdl:definitions name="HelloWorld"
> >> > targetNamespace="http://apache.org/hello_world_soap_http"
> >> > xmlns="http://schemas.xmlsoap.org/wsdl/"
> >> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >> > xmlns:tns="http://apache.org/hello_world_soap_http"
> >> > xmlns:x1="http://apache.org/hello_world_soap_http/types"
> >> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >> > <wsdl:types>
> >> > <schema
> >> > targetNamespace="
> >> http://apache.org/hello_world_soap_http/types"
> >> > xmlns="http://www.w3.org/2001/XMLSchema"
> >> > xmlns:tns="
> >> http://apache.org/hello_world_soap_http/types"
> >> > elementFormDefault="qualified">
> >> > <element name="pingMe">
> >> > <complexType />
> >> > </element>
> >> > <element name="pingMeResponse">
> >> > <complexType />
> >> > </element>
> >> > <element name="faultDetail"
> >> type="tns:faultDetail"
> >> />
> >> > <complexType name="faultDetail">
> >> > <sequence>
> >> > <element name="minor"
> >> type="short"
> >> />
> >> > <element name="major"
> >> type="short"
> >> />
> >> > </sequence>
> >> > </complexType>
> >> > <element name="subclassFaultDetail">
> >> > <complexType>
> >> > <complexContent>
> >> > <extension
> >> base="tns:faultDetail">
> >> > <sequence />
> >> > </extension>
> >> > </complexContent>
> >> > </complexType>
> >> > </element>
> >> > </schema>
> >> > </wsdl:types>
> >> > <wsdl:message name="pingMeRequest">
> >> > <wsdl:part name="in" element="x1:pingMe" />
> >> > </wsdl:message>
> >> > <wsdl:message name="pingMeResponse">
> >> > <wsdl:part name="out" element="x1:pingMeResponse" />
> >> > </wsdl:message>
> >> > <wsdl:message name="pingMeFault">
> >> > <wsdl:part name="faultDetail" element="x1:faultDetail"
> />
> >> > </wsdl:message>
> >> > <wsdl:message name="pingMeSubclassFault">
> >> > <wsdl:part name="faultDetail"
> >> element="x1:subclassFaultDetail" />
> >> > </wsdl:message>
> >> > <wsdl:portType name="Greeter">
> >> > <wsdl:operation name="pingMe">
> >> > <wsdl:input name="pingMeRequest"
> >> > message="tns:pingMeRequest" />
> >> > <wsdl:output name="pingMeResponse"
> >> > message="tns:pingMeResponse" />
> >> > <wsdl:fault name="pingMeFault"
> >> message="tns:pingMeFault" />
> >> > <wsdl:fault name="pingMeSubclassFault"
> >> > message="tns:pingMeSubclassFault" />
> >> > </wsdl:operation>
> >> > </wsdl:portType>
> >> > <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
> >> > <soap:binding style="document"
> >> > transport="http://schemas.xmlsoap.org/soap/http
> "
> >> />
> >> > <wsdl:operation name="pingMe">
> >> > <soap:operation style="document" />
> >> > <wsdl:input>
> >> > <soap:body use="literal" />
> >> > </wsdl:input>
> >> > <wsdl:output>
> >> > <soap:body use="literal" />
> >> > </wsdl:output>
> >> > <wsdl:fault name="pingMeFault">
> >> > <soap:fault name="pingMeFault"
> >> use="literal" />
> >> > </wsdl:fault>
> >> > <wsdl:fault name="pingMeSubclassFault">
> >> > <soap:fault name="pingMeSubclassFault"
> >> use="literal" />
> >> > </wsdl:fault>
> >> > </wsdl:operation>
> >> > </wsdl:binding>
> >> > <wsdl:service name="SOAPService">
> >> > <wsdl:port binding="tns:Greeter_SOAPBinding"
> >> name="SoapPort">
> >> > <soap:address
> >> > location="
> >> http://localhost:9000/SoapContext/SoapPort" />
> >> > </wsdl:port>
> >> > </wsdl:service>
> >> > </wsdl:definitions>
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16197927.html
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16200381.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>
Re: Generated Faults and Inheritance
Posted by Joel Turkel <Jo...@alumni.brown.edu>.
Is there anyway to do this using WSDL first development?
Benson Margulies-4 wrote:
>
> Aegis allows you to declare a base class in the throw clause and deliver
> specific subclasses based on the actual class thrown. All the classes in
> question end up in the wsdl.
>
>
>
> On Fri, Mar 21, 2008 at 9:41 AM, mikem2005 <mi...@gmail.com> wrote:
>
>>
>> I'm trying to do the same thing...does anyone know if hierarchical
>> exceptions
>> are possible with CXF?
>>
>> Thanks!
>> Mike
>>
>>
>>
>>
>> Joel Turkel wrote:
>> >
>> > Hi,
>> >
>> > Is there anyway to get CXF to generate an inheritance hierarchy of
>> users
>> > defined exceptions? For example, I'd like to generate something like
>> the
>> > following from a WSDL:
>> >
>> > public interface Greeter {
>> >
>> > public void pingMe() throws PingMeSubclassFault, PingMeFault;
>> >
>> > }
>> >
>> > where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
>> > doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
>> are
>> > not related via inheritance. The actually WSDL I'm working with has a
>> rich
>> > hierarchy of exception so the lack of exception inheritance makes the
>> > generated code hard to work with.
>> >
>> > Thanks,
>> > Joel
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <wsdl:definitions name="HelloWorld"
>> > targetNamespace="http://apache.org/hello_world_soap_http"
>> > xmlns="http://schemas.xmlsoap.org/wsdl/"
>> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> > xmlns:tns="http://apache.org/hello_world_soap_http"
>> > xmlns:x1="http://apache.org/hello_world_soap_http/types"
>> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> > <wsdl:types>
>> > <schema
>> > targetNamespace="
>> http://apache.org/hello_world_soap_http/types"
>> > xmlns="http://www.w3.org/2001/XMLSchema"
>> > xmlns:tns="
>> http://apache.org/hello_world_soap_http/types"
>> > elementFormDefault="qualified">
>> > <element name="pingMe">
>> > <complexType />
>> > </element>
>> > <element name="pingMeResponse">
>> > <complexType />
>> > </element>
>> > <element name="faultDetail"
>> type="tns:faultDetail"
>> />
>> > <complexType name="faultDetail">
>> > <sequence>
>> > <element name="minor"
>> type="short"
>> />
>> > <element name="major"
>> type="short"
>> />
>> > </sequence>
>> > </complexType>
>> > <element name="subclassFaultDetail">
>> > <complexType>
>> > <complexContent>
>> > <extension
>> base="tns:faultDetail">
>> > <sequence />
>> > </extension>
>> > </complexContent>
>> > </complexType>
>> > </element>
>> > </schema>
>> > </wsdl:types>
>> > <wsdl:message name="pingMeRequest">
>> > <wsdl:part name="in" element="x1:pingMe" />
>> > </wsdl:message>
>> > <wsdl:message name="pingMeResponse">
>> > <wsdl:part name="out" element="x1:pingMeResponse" />
>> > </wsdl:message>
>> > <wsdl:message name="pingMeFault">
>> > <wsdl:part name="faultDetail" element="x1:faultDetail" />
>> > </wsdl:message>
>> > <wsdl:message name="pingMeSubclassFault">
>> > <wsdl:part name="faultDetail"
>> element="x1:subclassFaultDetail" />
>> > </wsdl:message>
>> > <wsdl:portType name="Greeter">
>> > <wsdl:operation name="pingMe">
>> > <wsdl:input name="pingMeRequest"
>> > message="tns:pingMeRequest" />
>> > <wsdl:output name="pingMeResponse"
>> > message="tns:pingMeResponse" />
>> > <wsdl:fault name="pingMeFault"
>> message="tns:pingMeFault" />
>> > <wsdl:fault name="pingMeSubclassFault"
>> > message="tns:pingMeSubclassFault" />
>> > </wsdl:operation>
>> > </wsdl:portType>
>> > <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
>> > <soap:binding style="document"
>> > transport="http://schemas.xmlsoap.org/soap/http"
>> />
>> > <wsdl:operation name="pingMe">
>> > <soap:operation style="document" />
>> > <wsdl:input>
>> > <soap:body use="literal" />
>> > </wsdl:input>
>> > <wsdl:output>
>> > <soap:body use="literal" />
>> > </wsdl:output>
>> > <wsdl:fault name="pingMeFault">
>> > <soap:fault name="pingMeFault"
>> use="literal" />
>> > </wsdl:fault>
>> > <wsdl:fault name="pingMeSubclassFault">
>> > <soap:fault name="pingMeSubclassFault"
>> use="literal" />
>> > </wsdl:fault>
>> > </wsdl:operation>
>> > </wsdl:binding>
>> > <wsdl:service name="SOAPService">
>> > <wsdl:port binding="tns:Greeter_SOAPBinding"
>> name="SoapPort">
>> > <soap:address
>> > location="
>> http://localhost:9000/SoapContext/SoapPort" />
>> > </wsdl:port>
>> > </wsdl:service>
>> > </wsdl:definitions>
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16197927.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16200381.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Generated Faults and Inheritance
Posted by Benson Margulies <bi...@gmail.com>.
Aegis allows you to declare a base class in the throw clause and deliver
specific subclasses based on the actual class thrown. All the classes in
question end up in the wsdl.
On Fri, Mar 21, 2008 at 9:41 AM, mikem2005 <mi...@gmail.com> wrote:
>
> I'm trying to do the same thing...does anyone know if hierarchical
> exceptions
> are possible with CXF?
>
> Thanks!
> Mike
>
>
>
>
> Joel Turkel wrote:
> >
> > Hi,
> >
> > Is there anyway to get CXF to generate an inheritance hierarchy of users
> > defined exceptions? For example, I'd like to generate something like the
> > following from a WSDL:
> >
> > public interface Greeter {
> >
> > public void pingMe() throws PingMeSubclassFault, PingMeFault;
> >
> > }
> >
> > where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
> > doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
> are
> > not related via inheritance. The actually WSDL I'm working with has a
> rich
> > hierarchy of exception so the lack of exception inheritance makes the
> > generated code hard to work with.
> >
> > Thanks,
> > Joel
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions name="HelloWorld"
> > targetNamespace="http://apache.org/hello_world_soap_http"
> > xmlns="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:tns="http://apache.org/hello_world_soap_http"
> > xmlns:x1="http://apache.org/hello_world_soap_http/types"
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <wsdl:types>
> > <schema
> > targetNamespace="
> http://apache.org/hello_world_soap_http/types"
> > xmlns="http://www.w3.org/2001/XMLSchema"
> > xmlns:tns="
> http://apache.org/hello_world_soap_http/types"
> > elementFormDefault="qualified">
> > <element name="pingMe">
> > <complexType />
> > </element>
> > <element name="pingMeResponse">
> > <complexType />
> > </element>
> > <element name="faultDetail" type="tns:faultDetail"
> />
> > <complexType name="faultDetail">
> > <sequence>
> > <element name="minor" type="short"
> />
> > <element name="major" type="short"
> />
> > </sequence>
> > </complexType>
> > <element name="subclassFaultDetail">
> > <complexType>
> > <complexContent>
> > <extension
> base="tns:faultDetail">
> > <sequence />
> > </extension>
> > </complexContent>
> > </complexType>
> > </element>
> > </schema>
> > </wsdl:types>
> > <wsdl:message name="pingMeRequest">
> > <wsdl:part name="in" element="x1:pingMe" />
> > </wsdl:message>
> > <wsdl:message name="pingMeResponse">
> > <wsdl:part name="out" element="x1:pingMeResponse" />
> > </wsdl:message>
> > <wsdl:message name="pingMeFault">
> > <wsdl:part name="faultDetail" element="x1:faultDetail" />
> > </wsdl:message>
> > <wsdl:message name="pingMeSubclassFault">
> > <wsdl:part name="faultDetail"
> element="x1:subclassFaultDetail" />
> > </wsdl:message>
> > <wsdl:portType name="Greeter">
> > <wsdl:operation name="pingMe">
> > <wsdl:input name="pingMeRequest"
> > message="tns:pingMeRequest" />
> > <wsdl:output name="pingMeResponse"
> > message="tns:pingMeResponse" />
> > <wsdl:fault name="pingMeFault"
> message="tns:pingMeFault" />
> > <wsdl:fault name="pingMeSubclassFault"
> > message="tns:pingMeSubclassFault" />
> > </wsdl:operation>
> > </wsdl:portType>
> > <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
> > <soap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"
> />
> > <wsdl:operation name="pingMe">
> > <soap:operation style="document" />
> > <wsdl:input>
> > <soap:body use="literal" />
> > </wsdl:input>
> > <wsdl:output>
> > <soap:body use="literal" />
> > </wsdl:output>
> > <wsdl:fault name="pingMeFault">
> > <soap:fault name="pingMeFault"
> use="literal" />
> > </wsdl:fault>
> > <wsdl:fault name="pingMeSubclassFault">
> > <soap:fault name="pingMeSubclassFault"
> use="literal" />
> > </wsdl:fault>
> > </wsdl:operation>
> > </wsdl:binding>
> > <wsdl:service name="SOAPService">
> > <wsdl:port binding="tns:Greeter_SOAPBinding"
> name="SoapPort">
> > <soap:address
> > location="
> http://localhost:9000/SoapContext/SoapPort" />
> > </wsdl:port>
> > </wsdl:service>
> > </wsdl:definitions>
> >
>
> --
> View this message in context:
> http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16197927.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>
Re: Generated Faults and Inheritance
Posted by mikem2005 <mi...@gmail.com>.
I'm trying to do the same thing...does anyone know if hierarchical exceptions
are possible with CXF?
Thanks!
Mike
Joel Turkel wrote:
>
> Hi,
>
> Is there anyway to get CXF to generate an inheritance hierarchy of users
> defined exceptions? For example, I'd like to generate something like the
> following from a WSDL:
>
> public interface Greeter {
>
> public void pingMe() throws PingMeSubclassFault, PingMeFault;
>
> }
>
> where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
> doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault are
> not related via inheritance. The actually WSDL I'm working with has a rich
> hierarchy of exception so the lack of exception inheritance makes the
> generated code hard to work with.
>
> Thanks,
> Joel
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="HelloWorld"
> targetNamespace="http://apache.org/hello_world_soap_http"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://apache.org/hello_world_soap_http"
> xmlns:x1="http://apache.org/hello_world_soap_http/types"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <wsdl:types>
> <schema
> targetNamespace="http://apache.org/hello_world_soap_http/types"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http://apache.org/hello_world_soap_http/types"
> elementFormDefault="qualified">
> <element name="pingMe">
> <complexType />
> </element>
> <element name="pingMeResponse">
> <complexType />
> </element>
> <element name="faultDetail" type="tns:faultDetail" />
> <complexType name="faultDetail">
> <sequence>
> <element name="minor" type="short" />
> <element name="major" type="short" />
> </sequence>
> </complexType>
> <element name="subclassFaultDetail">
> <complexType>
> <complexContent>
> <extension base="tns:faultDetail">
> <sequence />
> </extension>
> </complexContent>
> </complexType>
> </element>
> </schema>
> </wsdl:types>
> <wsdl:message name="pingMeRequest">
> <wsdl:part name="in" element="x1:pingMe" />
> </wsdl:message>
> <wsdl:message name="pingMeResponse">
> <wsdl:part name="out" element="x1:pingMeResponse" />
> </wsdl:message>
> <wsdl:message name="pingMeFault">
> <wsdl:part name="faultDetail" element="x1:faultDetail" />
> </wsdl:message>
> <wsdl:message name="pingMeSubclassFault">
> <wsdl:part name="faultDetail" element="x1:subclassFaultDetail" />
> </wsdl:message>
> <wsdl:portType name="Greeter">
> <wsdl:operation name="pingMe">
> <wsdl:input name="pingMeRequest"
> message="tns:pingMeRequest" />
> <wsdl:output name="pingMeResponse"
> message="tns:pingMeResponse" />
> <wsdl:fault name="pingMeFault" message="tns:pingMeFault" />
> <wsdl:fault name="pingMeSubclassFault"
> message="tns:pingMeSubclassFault" />
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> <wsdl:operation name="pingMe">
> <soap:operation style="document" />
> <wsdl:input>
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output>
> <soap:body use="literal" />
> </wsdl:output>
> <wsdl:fault name="pingMeFault">
> <soap:fault name="pingMeFault" use="literal" />
> </wsdl:fault>
> <wsdl:fault name="pingMeSubclassFault">
> <soap:fault name="pingMeSubclassFault" use="literal" />
> </wsdl:fault>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="SOAPService">
> <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
> <soap:address
> location="http://localhost:9000/SoapContext/SoapPort" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
--
View this message in context: http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16197927.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Generated Faults and Inheritance
Posted by Joel Turkel <Jo...@alumni.brown.edu>.
Thanks for the suggestions guys...
I tried the Aegis approach using 2.0.4 (we don't want to use 2.1 yet).
Running Java2Wsdl on the WSDL it generated had the same problem of
PingMeSubclassFault not inheriting from PingMeFault. Is this something that
is changing in 2.1?
As a workaround, I followed Dan's suggestion and just used my own fault
classes (with proper annotations and the appropriate inheritance hierarchy)
instead of the fault classes generated from the WSDL.
This seems like a pretty common scenario. It's a shame that JAX-WS doesn't
cover it :(
dkulp wrote:
>
>
> I don't think so using "normal" looking java exception. You could do it
> if you model your exceptions exactly like the exceptions would look like
> if you generated code from wsdl. Basically, put the data in JAXB Beans
> that implement the heiarchy you want to see in the wsdl, then add "Bean
> getFaultInfo()" methods to the exceptions to return the JAXB Beans.
>
> Even then, I'm not sure if it will actually work.
>
> Dan
>
>
> On Tuesday 18 March 2008, Joel_Turkel wrote:
>> Hi,
>>
>> Is there anyway to get CXF to generate an inheritance hierarchy of
>> users defined exceptions? For example, I'd like to generate something
>> like the following from a WSDL:
>>
>> public interface Greeter {
>>
>> public void pingMe() throws PingMeSubclassFault, PingMeFault;
>>
>> }
>>
>> where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
>> doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
>> are not related via inheritance. The actually WSDL I'm working with
>> has a rich hierarchy of exception so the lack of exception inheritance
>> makes the generated code hard to work with.
>>
>> Thanks,
>> Joel
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <wsdl:definitions name="HelloWorld"
>> targetNamespace="http://apache.org/hello_world_soap_http"
>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:tns="http://apache.org/hello_world_soap_http"
>> xmlns:x1="http://apache.org/hello_world_soap_http/types"
>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <wsdl:types>
>> <schema
>> targetNamespace="http://apache.org/hello_world_soap_http/types"
>> xmlns="http://www.w3.org/2001/XMLSchema"
>> xmlns:tns="http://apache.org/hello_world_soap_http/types"
>> elementFormDefault="qualified">
>> <element name="pingMe">
>> <complexType />
>> </element>
>> <element name="pingMeResponse">
>> <complexType />
>> </element>
>> <element name="faultDetail" type="tns:faultDetail" />
>> <complexType name="faultDetail">
>> <sequence>
>> <element name="minor" type="short" />
>> <element name="major" type="short" />
>> </sequence>
>> </complexType>
>> <element name="subclassFaultDetail">
>> <complexType>
>> <complexContent>
>> <extension base="tns:faultDetail">
>> <sequence />
>> </extension>
>> </complexContent>
>> </complexType>
>> </element>
>> </schema>
>> </wsdl:types>
>> <wsdl:message name="pingMeRequest">
>> <wsdl:part name="in" element="x1:pingMe" />
>> </wsdl:message>
>> <wsdl:message name="pingMeResponse">
>> <wsdl:part name="out" element="x1:pingMeResponse" />
>> </wsdl:message>
>> <wsdl:message name="pingMeFault">
>> <wsdl:part name="faultDetail" element="x1:faultDetail" />
>> </wsdl:message>
>> <wsdl:message name="pingMeSubclassFault">
>> <wsdl:part name="faultDetail" element="x1:subclassFaultDetail" />
>> </wsdl:message>
>> <wsdl:portType name="Greeter">
>> <wsdl:operation name="pingMe">
>> <wsdl:input name="pingMeRequest"
>> message="tns:pingMeRequest" />
>> <wsdl:output name="pingMeResponse"
>> message="tns:pingMeResponse" />
>> <wsdl:fault name="pingMeFault" message="tns:pingMeFault" />
>> <wsdl:fault name="pingMeSubclassFault"
>> message="tns:pingMeSubclassFault" />
>> </wsdl:operation>
>> </wsdl:portType>
>> <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
>> <soap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http" />
>> <wsdl:operation name="pingMe">
>> <soap:operation style="document" />
>> <wsdl:input>
>> <soap:body use="literal" />
>> </wsdl:input>
>> <wsdl:output>
>> <soap:body use="literal" />
>> </wsdl:output>
>> <wsdl:fault name="pingMeFault">
>> <soap:fault name="pingMeFault" use="literal" />
>> </wsdl:fault>
>> <wsdl:fault name="pingMeSubclassFault">
>> <soap:fault name="pingMeSubclassFault" use="literal" />
>> </wsdl:fault>
>> </wsdl:operation>
>> </wsdl:binding>
>> <wsdl:service name="SOAPService">
>> <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
>> <soap:address
>> location="http://localhost:9000/SoapContext/SoapPort" />
>> </wsdl:port>
>> </wsdl:service>
>> </wsdl:definitions>
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
--
View this message in context: http://www.nabble.com/Generated-Faults-and-Inheritance-tp16133913p16291480.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Generated Faults and Inheritance
Posted by Daniel Kulp <dk...@apache.org>.
I don't think so using "normal" looking java exception. You could do it
if you model your exceptions exactly like the exceptions would look like
if you generated code from wsdl. Basically, put the data in JAXB Beans
that implement the heiarchy you want to see in the wsdl, then add "Bean
getFaultInfo()" methods to the exceptions to return the JAXB Beans.
Even then, I'm not sure if it will actually work.
Dan
On Tuesday 18 March 2008, Joel_Turkel wrote:
> Hi,
>
> Is there anyway to get CXF to generate an inheritance hierarchy of
> users defined exceptions? For example, I'd like to generate something
> like the following from a WSDL:
>
> public interface Greeter {
>
> public void pingMe() throws PingMeSubclassFault, PingMeFault;
>
> }
>
> where PingMeSubclassFault is a subclass of PingMeFault. The WSDL below
> doesn't seem to do the trick i.e. PingMeFault and PingMeSubclassFault
> are not related via inheritance. The actually WSDL I'm working with
> has a rich hierarchy of exception so the lack of exception inheritance
> makes the generated code hard to work with.
>
> Thanks,
> Joel
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="HelloWorld"
> targetNamespace="http://apache.org/hello_world_soap_http"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://apache.org/hello_world_soap_http"
> xmlns:x1="http://apache.org/hello_world_soap_http/types"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <wsdl:types>
> <schema
> targetNamespace="http://apache.org/hello_world_soap_http/types"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:tns="http://apache.org/hello_world_soap_http/types"
> elementFormDefault="qualified">
> <element name="pingMe">
> <complexType />
> </element>
> <element name="pingMeResponse">
> <complexType />
> </element>
> <element name="faultDetail" type="tns:faultDetail" />
> <complexType name="faultDetail">
> <sequence>
> <element name="minor" type="short" />
> <element name="major" type="short" />
> </sequence>
> </complexType>
> <element name="subclassFaultDetail">
> <complexType>
> <complexContent>
> <extension base="tns:faultDetail">
> <sequence />
> </extension>
> </complexContent>
> </complexType>
> </element>
> </schema>
> </wsdl:types>
> <wsdl:message name="pingMeRequest">
> <wsdl:part name="in" element="x1:pingMe" />
> </wsdl:message>
> <wsdl:message name="pingMeResponse">
> <wsdl:part name="out" element="x1:pingMeResponse" />
> </wsdl:message>
> <wsdl:message name="pingMeFault">
> <wsdl:part name="faultDetail" element="x1:faultDetail" />
> </wsdl:message>
> <wsdl:message name="pingMeSubclassFault">
> <wsdl:part name="faultDetail" element="x1:subclassFaultDetail" />
> </wsdl:message>
> <wsdl:portType name="Greeter">
> <wsdl:operation name="pingMe">
> <wsdl:input name="pingMeRequest"
> message="tns:pingMeRequest" />
> <wsdl:output name="pingMeResponse"
> message="tns:pingMeResponse" />
> <wsdl:fault name="pingMeFault" message="tns:pingMeFault" />
> <wsdl:fault name="pingMeSubclassFault"
> message="tns:pingMeSubclassFault" />
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> <wsdl:operation name="pingMe">
> <soap:operation style="document" />
> <wsdl:input>
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output>
> <soap:body use="literal" />
> </wsdl:output>
> <wsdl:fault name="pingMeFault">
> <soap:fault name="pingMeFault" use="literal" />
> </wsdl:fault>
> <wsdl:fault name="pingMeSubclassFault">
> <soap:fault name="pingMeSubclassFault" use="literal" />
> </wsdl:fault>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="SOAPService">
> <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
> <soap:address
> location="http://localhost:9000/SoapContext/SoapPort" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog