rsoap
A SOAP client library for Rust with compile-time code generation from WSDL files.
The rsoap workspace provides a runtime client (rsoap) and a procedural macro (rsoap-macros) that parses a WSDL at compile time and generates typed request/response structs, so SOAP services feel like ordinary Rust APIs.
Workspace
| Crate | Role |
|---|---|
rsoap/ |
Runtime library — SoapClient, SoapOperation trait, envelope/XML parsing, SoapError |
rsoap-macros/ |
Proc-macro crate — WSDL parser → typed struct generation |
examples/ |
Demo — weather service (hand-written SoapOperation impl) |
Quick Start
Add the runtime crate and the derive macro to your Cargo.toml:
[]
= { = "../rsoap" }
= { = "../rsoap-macros" }
= { = "1", = ["full"] }
= { = "1", = ["derive"] }
= "1"
Derive a typed operation from a WSDL at compile time:
use ;
;
async
The macro reads the WSDL, resolves the GetTemperature operation, generates gettemperature::Request and gettemperature::Response with #[serde(rename = "...")] on every field, and implements SoapOperation for the marker struct.
Features
- Compile-time WSDL parsing — no runtime XML schema download, no manual struct definitions.
- Typed request/response — generated structs with
serderename attributes match the XSD element names. maxOccurs="unbounded"— automatically wrapped inVec<T>.- XSD → Rust type mapping —
xs:string→String,xs:int→i32,xs:long→i64,xs:float/xs:double/xs:decimal→f64,xs:boolean→bool,xs:date/xs:dateTime→String. - SOAP 1.1 envelopes —
<Action>header (WS-Addressing), fault detection on<soap:Fault>/<Fault xmlns=...>. - Custom headers —
.with_header(name, value)for auth, tracing, etc. - Namespace-prefix tolerant — handles
xs:,xsd:,wsdl:,soap:,wsdlsoap:, and bare tags in WSDLs.
SoapError
Implements From<reqwest::Error> for ergonomic ? propagation.
SoapOperation trait
Build & Test
# Build everything
# Lint (correctness is deny-level — hard failures)
# Run all tests (unit + integration + doc tests)
# Run specific test suites
Configuration
The workspace enforces strict lints at the root Cargo.toml:
[]
= { = "deny" }
= { = "warn" }
= { = "warn" }
= { = "warn" }
= { = "warn" }
[]
= "warn"
= "deny"
unsafe is never allowed. missing_docs is warn-level — doc comments on public items are encouraged.
Limitations
- The string-based WSDL parser is tolerant of real-world WSDL quirks (namespace prefixes, self-closing tags, attributes between tag name and
>) but is not a full XML schema validator. Malformed WSDLs may produce surprising results. - SOAP 1.1 only. SOAP 1.2 is not yet supported.
- No MTOM / attachments.
rsoap-macrosreads the WSDL at compile time, so the file path must be valid relative to the crate root where#[derive]is invoked.
License
See LICENSE.