Class WinRMFaultException

All Implemented Interfaces:
Serializable

public class WinRMFaultException extends WinRMClientException
The remote WinRM service answered with a WSMan fault (or a non-success HTTP status).

Beyond the human-readable message, the fault is exposed programmatically: getFaultCode() is the numeric WSManFault code (e.g. 2150858778) and getFaultDetail() the provider-level detail text — where WMI puts mnemonics such as WBEM_E_INVALID_CLASS or WBEM_E_INVALID_NAMESPACE that callers historically had to extract from the message with contains().

See Also:
  • Constructor Details

    • WinRMFaultException

      public WinRMFaultException(String message, int httpStatus, String faultCode, String faultReason, String faultDetail)
      Create the exception.
      Parameters:
      message - the complete detail message (same format as the legacy API)
      httpStatus - the HTTP status of the faulting response
      faultCode - the WSManFault code, or null when the response carried none
      faultReason - the SOAP fault reason text, or null
      faultDetail - the detailed WSManFault message (provider-level detail), or null
  • Method Details

    • getHttpStatus

      public int getHttpStatus()
      Get the HTTP status of the faulting response (typically 500 for a SOAP fault).
      Returns:
      the HTTP status code
    • getFaultCode

      public String getFaultCode()
      Get the numeric WSManFault code, e.g. 2150858778.
      Returns:
      the fault code, or null when the response carried none
    • getFaultReason

      public String getFaultReason()
      Get the SOAP fault reason text.
      Returns:
      the reason text, or null
    • getFaultDetail

      public String getFaultDetail()
      Get the detailed WSManFault message — the provider-level detail where WMI puts mnemonics such as WBEM_E_INVALID_CLASS.
      Returns:
      the fault detail, or null