private GetRecipientConfigurationsResponse parseGetRecipientConfigurations(ServiceResponse Response) { GetRecipientConfigurationsResponse response = Response.Factory <GetRecipientConfigurationsResponse>(); if (Response.IsSuccess) { try { XElement configResponse = Response.SOAPContent.Element(NS_SOAP_ENV + "Body").Element(NS_ACTION + "GetRecipientConfigurationsResponse").Element(NS_ACTION + "RecipientConfigurations"); RecipientConfiguration recipient; foreach (XElement el in configResponse.Elements()) { recipient = new RecipientConfiguration(); recipient.ConfigurationID = int.Parse(el.Element(NS_ACTION + "ConfigurationID").Value); recipient.TemplateToken = el.Element(NS_ACTION + "TemplateToken").Value; recipient.Name = el.Element(NS_ACTION + "Name").Value; foreach (XElement element in el.Element(NS_ACTION + "Parameters").Elements()) { recipient.Parameters.Add( element.Attribute("Name").Value, element.Attribute("Value").Value ); } response.Configurations.Add(recipient); } } catch (Exception ex) { Response.IsSuccess = false; Response.Content = "[ParseRecipientConfigurations] " + ex.Message; } } return(response); }
/// <summary> /// Method to create a new Recipient Configuration on a device /// If success the ID field of the passed Recipient Configuration instance will be set with the ID returned in the response /// </summary> /// <param name="IP">The device ip address</param> /// <param name="User">User to authenticate the http request</param> /// <param name="Password">Password to use</param> /// <param name="Configuration"></param> /// <returns>Returns the ID of the configuration stored on the device</returns> public async Task <ServiceResponse> AddRecipientConfigurationAsync(string IP, string User, string Password, RecipientConfiguration Configuration) { return(parseAddRecipientConfigResponse(await base.sendRequestAsync(IP, User, Password, @"<act:AddRecipientConfiguration><act:NewRecipientConfiguration>" + Configuration.ToString() + @"</act:NewRecipientConfiguration></act:AddRecipientConfiguration>"), Configuration)); }
private ServiceResponse parseAddRecipientConfigResponse(ServiceResponse Response, RecipientConfiguration Configuration) { if (Response.IsSuccess) { try { Response.Content = Response.SOAPContent.Element(NS_SOAP_ENV + "Body").Element(NS_ACTION + "AddRecipientConfigurationResponse").Element(NS_ACTION + "ConfigurationID").Value; Configuration.ConfigurationID = int.Parse(Response.Content); } catch (Exception ex) { Response.IsSuccess = false; Response.Content = "[ParseAddRecipientConfigResponse] " + ex.Message; } } return(Response); }