Skip to content

SOAP

Client-independent SOAP support.

SOAP is an HTTP-based protocol

This packages provides implementations specific to SOAP. The generic HTTP features are available as a part of HTTP support.

Markers

operation_name

operation_name(name: str) -> Callable[[FunctionT], FunctionT]

Mark a service call's operation name.

Examples:

>>> class SupportsNumberConversion(SupportsService):
>>>     @operation_name("NumberToWords")
>>>     def number_to_words(self) -> ...:
>>>         ...
See Also
Source code in combadge/support/soap/markers.py
def operation_name(name: str) -> Callable[[FunctionT], FunctionT]:
    """
    Mark a service call's operation name.

    Examples:
        >>> class SupportsNumberConversion(SupportsService):
        >>>     @operation_name("NumberToWords")
        >>>     def number_to_words(self) -> ...:
        >>>         ...

    See Also:
        - [Structure of a WSDL message](https://www.ibm.com/docs/en/rtw/9.0.0?topic=documents-structure-wsdl-message)
    """
    return OperationName[Any](name).mark

Responses

Response extensions for SOAP.

BaseSoapFault

Bases: ErrorResponse

SOAP Fault error response model.

This class is intended for use with the SOAP Fault specification

For custom errors returned in a SOAP response body (such as <error> tag), subclass the ErrorResponse.

Tip

SOAP backends should always fall back to BaseSoapFault if the actual SOAP fault does not match any of the protocol's return types.

For client developers, this means that it is a good idea to include BaseSoapFault as the last possible Union variant to let users know that is should be handled.

Source code in combadge/support/soap/response.py
class BaseSoapFault(ErrorResponse):
    """
    [SOAP Fault][1] error response model.

    [1]: https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507

    Note: This class is intended for use with the SOAP Fault specification
        For custom errors returned in a SOAP response body (such as `<error>` tag),
        subclass the `ErrorResponse`.

    Tip:
        SOAP backends should **always** fall back to `BaseSoapFault` if the actual SOAP fault
        does not match any of the protocol's return types.

        For client developers, this means that it is a good idea to include `BaseSoapFault`
        as the last possible `Union` variant to let users know that is should be handled.
    """

    code: str
    message: str

    def raise_for_result(self, exception: Optional[BaseException] = None) -> NoReturn:
        """Raise the derived error for this fault."""
        if not exception:
            raise self.Error(self)
        raise exception from self.Error(self)

raise_for_result

raise_for_result(exception: Optional[BaseException] = None) -> NoReturn

Raise the derived error for this fault.

Source code in combadge/support/soap/response.py
def raise_for_result(self, exception: Optional[BaseException] = None) -> NoReturn:
    """Raise the derived error for this fault."""
    if not exception:
        raise self.Error(self)
    raise exception from self.Error(self)