I am using spring webservices to expose my services as web services. I defined my Soap fault element like this
<xsd:element name="systemFault">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="faultCode" type="xsd:string" nillable="true"/>
<xsd:element name="faultMessage" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
and I am using this in my WSDL
<wsdl开发者_运维知识库:message name="msgSystemFault">
<wsdl:part name="body" element="cred:SystemFault"/>
</wsdl:message>
and then use this in an operation
<wsdl:operation name="opMyOp">
<wsdl:documentation>
Creating an entity note.
</wsdl:documentation>
<wsdl:input message="tns:msgMyOpRequest"/>
<wsdl:output message="tns:msgMyOpResponse"/>
<wsdl:fault name="fault" message="tns:msgSystemFault"/>
</wsdl:operation>
But when I want to throw this fault in my endpoint, how can I do that??
You need a EndpointExceptionResolver, see SpringWS manual about handling exceptions.
SpringWS comes with some built-in exception resolves, you can use those as a reference when implementing your own.
精彩评论