pub struct ServerBuilder { /* private fields */ }Expand description
Builder for a SoapService. Accumulates WSDL source, handlers, auth config, and routing.
Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sourcepub fn from_wsdl_file(path: impl Into<PathBuf>) -> Self
pub fn from_wsdl_file(path: impl Into<PathBuf>) -> Self
Load WSDL from the given file path at build time.
Sourcepub fn from_wsdl_bytes(bytes: impl Into<Vec<u8>>) -> Self
pub fn from_wsdl_bytes(bytes: impl Into<Vec<u8>>) -> Self
Use the provided WSDL bytes directly (no file I/O).
For WSDLs with external imports, use from_wsdl_file or from_wsdl_bytes_with_loader.
Sourcepub fn from_wsdl_bytes_with_loader(
bytes: impl Into<Vec<u8>>,
loader: impl WsdlLoader + 'static,
) -> Self
pub fn from_wsdl_bytes_with_loader( bytes: impl Into<Vec<u8>>, loader: impl WsdlLoader + 'static, ) -> Self
Use the provided WSDL bytes with a custom loader for resolving external imports.
The loader is invoked for any wsdl:import or xs:import location strings.
Sourcepub fn handler(
self,
operation: impl Into<String>,
handler: impl SoapHandler,
) -> Self
pub fn handler( self, operation: impl Into<String>, handler: impl SoapHandler, ) -> Self
Register a handler for the named WSDL operation.
Sourcepub fn default_handler(self, handler: impl SoapHandler) -> Self
pub fn default_handler(self, handler: impl SoapHandler) -> Self
Register a catch-all handler invoked for any WSDL operation without a specific handler.
When set, build() will not return UnregisteredOperation for unhandled operations.
Sourcepub fn auth<F>(self, f: F) -> Self
pub fn auth<F>(self, f: F) -> Self
Configure credential lookup, enabling WS-Security enforcement. The closure is called
with a username and must return the stored password (plaintext) for that user, or
None if the user does not exist.
If auth is never called, the server runs unauthenticated: WS-Security headers
are not required or validated on any operation. Calling auth enables WS-Security
enforcement on all non-bypassed operations (see auth_bypass).
Sourcepub fn auth_bypass<I, S>(self, ops: I) -> Self
pub fn auth_bypass<I, S>(self, ops: I) -> Self
Mark the named operations as auth-bypassed (no WS-Security header required). Accepts any iterable of string-like values.
Sourcepub fn timestamp_tolerance_secs(self, secs: i64) -> Self
pub fn timestamp_tolerance_secs(self, secs: i64) -> Self
Override the WS-Security timestamp tolerance in seconds (default: 300).
Sourcepub fn max_body_bytes(self, bytes: usize) -> Self
pub fn max_body_bytes(self, bytes: usize) -> Self
Set the maximum allowed request body size in bytes (default: 2 MiB).
Requests whose body exceeds this limit are rejected before XML parsing begins, preventing memory exhaustion from oversized payloads.
Sourcepub fn build(self) -> Result<SoapService, BuildError>
pub fn build(self) -> Result<SoapService, BuildError>
Build the SoapService, resolving the WSDL and building the dispatch table. Returns an error if the WSDL cannot be resolved or the dispatch table is inconsistent.