HTTP+mTLS POST of a SOAP envelope.
A behaviour, so a host can substitute its own transport and so mix test
never opens a socket. SefazNfe.SOAP.HTTPC is the default implementation.
Summary
Types
@type cert() :: SefazNfe.Certificate.t()
Callbacks
Functions
@spec client() :: module()
The configured client, defaulting to the real mTLS one.
The default is deliberately the working client: a host that installs this
library should be able to call SEFAZ without extra configuration. The test
suite swaps it for SefazNfe.SOAP.NotImplemented in config/test.exs, which
is what keeps mix test off the network.
@spec isolated_call(String.t(), iodata(), cert(), keyword()) :: {:ok, String.t()} | {:error, term()}
Runs call/4 in SefazNfe.TaskSupervisor so an SSL/SOAP abort
does not take down the caller (Jurić: I/O failure domain).
Emits [:sefaz_nfe, :soap, :start | :stop | :exception] (SEFAZ-14). The
:uf and :service options are consumed here as telemetry metadata; every
other option is forwarded to call/4. Metadata never carries the
certificate, the password or the XML body — only the endpoint, the UF, the
service and an outcome tag. That tag is deliberately low cardinality: the raw
reason would drag a whole {:soap_crash, stacktrace} into every metrics
label.
Calls are gated by SefazNfe.CircuitBreaker on :uf, so a UF that stops
answering fails fast instead of costing every caller a full timeout.