📜  SOAP-故障

📅  最后修改于: 2020-12-13 14:37:28             🧑  作者: Mango


如果在处理过程中发生错误,则对SOAP消息的响应是消息正文中的SOAP故障元素,并且该故障将返回给SOAP消息的发送者。

SOAP故障机制返回有关错误的特定信息,包括预定义的代码,描述和产生故障的SOAP处理器的地址。

注意事项

  • SOAP消息只能携带一个故障块。

  • 故障是SOAP消息的可选部分。

  • 对于HTTP绑定,成功的响应将链接到200到299范围的状态码。

  • SOAP Fault链接到状态代码的500到599范围。

故障的子元素

SOAP Fault具有以下子元素-

Sr.No Sub-element & Description
1

It is a text code used to indicate a class of errors. See the next Table for a listing of predefined fault codes.

2

It is a text message explaining the error.

3

It is a text string indicating who caused the fault. It is useful if the SOAP message travels through several nodes in the SOAP message path, and the client needs to know which node caused the error. A node that does not act as the ultimate destination must include a faultActor element.

4

It is an element used to carry application-specific error messages. The detail element can contain child elements called detail entries.

SOAP故障代码

描述故障时,必须在faultcode元素中使用下面定义的faultCode值。

Sr.No Error & Description
1

SOAP-ENV:VersionMismatch

Found an invalid namespace for the SOAP Envelope element.

2

SOAP-ENV:MustUnderstand

An immediate child element of the Header element, with the mustUnderstand attribute set to “1”, was not understood.

3

SOAP-ENV:Client

The message was incorrectly formed or contained incorrect information.

4

SOAP-ENV:Server

There was a problem with the server, so the message could not proceed.

SOAP故障示例

以下代码是故障示例。客户端请求了一个名为ValidateCreditCard的方法,但该服务不支持这种方法。这代表客户端请求错误,并且服务器返回以下SOAP响应-




   
      
         SOAP-ENV:Client
         
            Failed to locate method (ValidateCreditCard) in class (examplesCreditCard) at
               /usr/local/ActivePerl-5.6/lib/site_perl/5.6.0/SOAP/Lite.pm line 1555.