servicemix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattrpav <matt.pavlov...@airband.com>
Subject Re: CXF and undefined SOAPFaults
Date Thu, 08 Jan 2009 22:46:52 GMT

UPDATE -- My goal is to be able to set the text in the 'faultstring' element. 
MS .NET does not handle custom faults really well.  Instead of deserializing
back to an object, it passes in a DOMElement.  In the interest in maximum
compatibility, I'd like to be able to just set the 'faultstring', which
makes life easier for .NET users.

Note --  the <faultstring> gets set to 'Fault occured', but I do not set
that anywhere.  Additionally,  the 'My Message' text is never returned in
the SOAP.

Thanks.

<!-- XSD -->
	<xs:element name="ErrorMessage" type="cmn:ErrorMessage" />
	<xs:complexType name="ErrorMessage">
		<xs:sequence>
			<xs:element name="ErrorMessage" type="xs:string" />
		</xs:sequence>
	</xs:complexType>
 
<!-- WSDL -->
	<!-- Message -->
	<wsdl:message name="FaultMessage">
		<wsdl:part name="parameters" element="cmn:ErrorMessage"></wsdl:part>
	</wsdl:message>
 
	<!--  Port -->
	<wsdl:portType name="CrmPort">
		<wsdl:operation name="GetCustomer">
			<wsdl:input message="ws:GetCustomer" />
			<wsdl:output message="ws:GetCustomerResponse" />
            <wsdl:fault name="FaultMessage" message="ws:FaultMessage" />
        </wsdl:operation>
	</wsdl:portType>
 
	<!--  Binding -->
	<wsdl:operation name="GetCustomer">
		<soap:operation soapAction="http://airband.com/crm/ws/GetCustomer" />
		<wsdl:input>
			<soap:body use="literal" />
		</wsdl:input>
		<wsdl:output>
			<soap:body use="literal" />
		</wsdl:output>
		<wsdl:fault name="FaultMessage">
			<soap:fault name="FaultMessage" use="literal" />
		</wsdl:fault>
	</wsdl:operation>
 
 
<!--  Returns -->
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
	<soap:Body>
		<soap:Fault>
			<faultcode>soap:Server</faultcode>
			<faultstring>Fault occured</faultstring>
			<detail>
				<ns3:ErrorMessage xmlns="http://airband.com/crm/xml"
					xmlns:ns2="http://airband.com/crm/ws"
xmlns:ns3="http://airband.com/common/xml">
					<ns3:ErrorMessage>Customer 7777 not found.</ns3:ErrorMessage>
				</ns3:ErrorMessage>
			</detail>
		</soap:Fault>
	</soap:Body>
</soap:Envelope>
 
<!-- Java -->
  public com.airband.crm.xml.Customer getCustomer(int customerId) throws
FaultMessage    { 
        try {
        	logic = new CrmLogic();
        	return logic.getCustomer(customerId);
        } catch (Exception ex) { 
            com.airband.common.xml.ObjectFactory of = new
com.airband.common.xml.ObjectFactory();
            ErrorMessage em = of.createErrorMessage();
            em.setErrorMessage(ex.getMessage());
            throw new FaultMessage("My message", em);
        }
    }

-- 
View this message in context: http://www.nabble.com/CXF-and-undefined-SOAPFaults-tp20507469p21362429.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Mime
View raw message