Expand description
§rsoap
A SOAP client library for Rust with compile-time code generation from WSDL files.
§Quick Start
use rsoap::{SoapClient, SoapOperation};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = SoapClient::new("https://example.com/soap")?;
// Generated operation methods are called on the generated client trait impls.
Ok(())
}§Code Generation
The #[derive(SoapOperationMacro)] macro reads a WSDL file at compile time and generates:
- Typed request/response structs matching the WSDL schema
- An implementation of
SoapOperationfrom [rsoap::client]
ⓘ
use rsoap::{SoapClient, SoapOperation};
#[derive(SoapOperationMacro)]
#[soap(wsdl = "path/to/service.wsdl", operation_name = "GetWeather")]
pub struct GetWeather;
async fn get_temp(client: &SoapClient) -> anyhow::Result<()> {
let request = getweather::Request { zipcode: "90210".into() };
let response = client.call(&GetWeather, &request).await?;
println!("Temp: {}", response.temperature);
}Re-exports§
pub use self::client::SoapClient;pub use self::client::SoapOperation;pub use self::envelope::SoapVersion;pub use self::error::CertError;pub use self::error::SoapError;pub use quick_xml;pub use serde;pub use thiserror;
Modules§
- client
- HTTP transport for SOAP clients.
- envelope
- SOAP envelope construction and parsing utilities.
- error
- Error types for Soap operations.
Derive Macros§
- Soap
Operation Macro - Derive macro that parses a WSDL at compile-time and generates typed request/response structs.