我正在使用 spring webservices 将我的服务公开为 web 服务。 我这样定义了我的 Soap 故障元素
<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>
我正在我的 WSDL 中使用它
<wsdl:message name="msgSystemFault">
<wsdl:part name="body" element="cred:SystemFault"/>
</wsdl:message>
然后在操作中使用它
<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>
但是当我想在我的端点中抛出这个错误时,我该怎么做呢??
最佳答案
您需要一个EndpointExceptionResolver,请参阅有关handling exceptions 的SpringWS 手册.
SpringWS 带有一些内置的异常解决方案,您可以在实现自己的解决方案时将其用作引用。
关于java - Spring 返回自定义 SOAP 故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4078591/