serde-xml-rs
serde-xml-rs copied to clipboard
Custom { field: "missing field `soap:Body`" } when colon used
I am trying to decode this xml message:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><AuthenticateUserResponse xmlns="http://oneclickforapp.dpag.de/V3"><userToken>USERTOKEN</userToken><walletBalance>100000</walletBalance><showTermsAndConditions>true</showTermsAndConditions></AuthenticateUserResponse></soap:Body></soap:Envelope>
This is my code:
#[derive(Serialize,Deserialize)]
struct XMLEnvelope {
#[serde(rename = "soap:Body")]
pub body: XMLSoapBody
}
#[derive(Serialize,Deserialize)]
struct XMLSoapBody {
#[serde(rename = "AuthenticateUserResponse")]
pub response: XMLAuthenticateUserResponse
}
#[derive(Serialize,Deserialize)]
struct XMLAuthenticateUserResponse {
pub userToken: String
}
But it results in this error: Err value: Custom { field: "missing field soap:Body" }'
If I change soap:Body to soapBody. (int the code and xml file). Then it works without a problem. The problem seems to be the colon (:).