From fca155b4208955075109a024c81a8037dd5a2ed6 Mon Sep 17 00:00:00 2001 From: Joe WOlfgrma Date: Sun, 7 Jul 2024 20:10:14 -0400 Subject: [PATCH] Fix for 400 error, needs additional header to work successfully --- onvif/src/soap/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/onvif/src/soap/mod.rs b/onvif/src/soap/mod.rs index 4a0c6ab..b86ceba 100644 --- a/onvif/src/soap/mod.rs +++ b/onvif/src/soap/mod.rs @@ -6,6 +6,7 @@ mod tests; use auth::username_token::UsernameToken; use schema::soap_envelope; use xmltree::{Element, Namespace, XMLNode}; +use url::Url; const SOAP_URI: &str = "http://www.w3.org/2003/05/soap-envelope"; @@ -24,11 +25,12 @@ pub struct Response { pub response: Option, } -pub fn soap(xml: &str, username_token: &Option) -> Result { +pub fn soap(xml: &str, username_token: &Option, uri: &Url) -> Result { let app_data = parse(xml)?; let mut namespaces = app_data.namespaces.clone().unwrap_or_else(Namespace::empty); namespaces.put("s", SOAP_URI); + namespaces.put("a", "http://www.w3.org/2005/08/addressing"); let mut body = Element::new("Body"); body.prefix = Some("s".to_string()); @@ -44,6 +46,10 @@ pub fn soap(xml: &str, username_token: &Option) -> Result