Skip to main content

ServerBuilder

Struct ServerBuilder 

Source
pub struct ServerBuilder { /* private fields */ }
Expand description

Builder for a SoapService. Accumulates WSDL source, handlers, auth config, and routing.

Implementations§

Source§

impl ServerBuilder

Source

pub fn from_wsdl_file(path: impl Into<PathBuf>) -> Self

Load WSDL from the given file path at build time.

Source

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.

Source

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.

Source

pub fn handler( self, operation: impl Into<String>, handler: impl SoapHandler, ) -> Self

Register a handler for the named WSDL operation.

Source

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.

Source

pub fn auth<F>(self, f: F) -> Self
where F: Fn(&str) -> Option<String> + Send + Sync + 'static,

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).

Source

pub fn auth_bypass<I, S>(self, ops: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Mark the named operations as auth-bypassed (no WS-Security header required). Accepts any iterable of string-like values.

Source

pub fn path(self, path: impl Into<String>) -> Self

Override the mount path (default: “/soap”).

Source

pub fn timestamp_tolerance_secs(self, secs: i64) -> Self

Override the WS-Security timestamp tolerance in seconds (default: 300).

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more