cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Generated Faults and Inheritance
Date Fri, 21 Mar 2008 16:54:09 GMT

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

Mime
View raw message