次の方法で共有


Client and Server Error Handling (Windows Embedded CE 6.0)

1/6/2010

The SoapServer and SoapClient objects (accessed using the ISoapServer and ISoapClient interfaces) handle errors in a specific way.

The server handles errors using the following steps:

  1. If the COM object on the server returns an error, the SoapServer object queries the COM object for the ISOAPError interface.
  2. If the COM object implements the ISOAPError interface, the SoapServer object creates a <Fault> element that meets the following conditions:
    • The <faultcode> child element is set to the string returned by the faultcode property of the ISOAPError interface with a namespace prefix that identifies the namespace URI returned by the faultcodeNS property of the ISOAPError interface.
    • The <faultstring> child element is set to the value returned by the faultstring property of the ISOAPError interface.
    • The <faultactor> child element is set to the value returned by the faultactor property of the ISOAPError interface.
      If the faultactor property returns an empty string or a null value, the <faultactor> child element is set to the service address specified in the Web Services Description Language (WSDL) document used to initialize the server.
    • The <detail> child element is set to the XML text returned by the detail property of the ISOAPError interface.
      The detail property must contain valid XML content, with text strings placed inside elements and properly escaped according to XML rules.
  3. If the COM object does not implement the ISOAPError interface, but supports the COM IErrorInfo interface, the SoapServer object creates a <Fault> element that meets the following conditions:
    • The <faultcode> child element is set to "SOAP-ENV:Client".
    • The <faultstring> child element is set to the value returned by the GetDescription method of the IErrorInfo interface.
    • The <faultactor> child element is set to the service address specified in the WSDL document used to initialize the server.
    • The <detail> child element is set to the content described in Understanding the SOAP Fault <detail> Contents.
  4. If the COM object does not support the ISOAPError interface or the IErrorInfo interface, the SoapServer object creates a <Fault> element that meets the following conditions:
    • The <faultcode> child element is set to "SOAP-ENV:Client".
    • The <faultstring> child element is set to a message containing the name of the method that failed.
    • the <faultactor> child element is set to the service address specified in the WSDL document used to initialize the server.
    • The <detail> child element is set to the content described in the Understanding the SOAP Fault <detail> Contents.

In client error handling, if the server returns a SOAP message containing a <Fault> element to the client, the <faultcode>, <faultstring>, <faultactor> and <detail> element values in the SOAP message are copied to the corresponding properties in the SoapClient object.

Also, the client generates an ErrorInfo object that can be used through the Err object.

If the error occurs on the client (for example, during initialization), the SoapClient object generates values for its error properties: faultcode, faultstring, faultactor, and detail.

As with an error occurring on the server, the SoapClient also sets an ErrorInfo object.

See Also

Concepts

SOAP Application Development