private ds_request BuildRequestObject() { ds_request theRequest = new ds_request(); additionalclient addlClient = new additionalclient(); applicant1 appl1 = new applicant1(); name applicantName = new name(); applicantName.title = cmbTitle.Text; applicantName.forename = txtFirstName.Text; applicantName.surname = txtLastName.Text; applicantName.dob = Convert.ToDateTime(dtpDOB.Text).ToString("yyyy-MM-dd"); appl1.name = applicantName; appl1.current_address = new current_address(); appl1.contact_telephone_1 = new contact_telephone_1(); appl1.contact_email_1 = new contact_email_1(); addresses addrs = new addresses(); Address1 addr1 = new Address1(); UKAddress ukaddr = new UKAddress(); ukaddr.abodeno = txtFlatNo.Text; ukaddr.house_name = txtHouseName.Text; ukaddr.house_number = txtHouseNo.Text; ukaddr.street1 = txtStreet.Text; ukaddr.posttown = txtTown.Text; ukaddr.postcode = txtPostCode.Text; addr1.UKAddress = ukaddr; addrs.Address1 = addr1; if (chkEnfBankChk.Checked) { addlClient.val_3d_status = "FAIL"; appl1.bank = new bank(); appl1.bank.account_number = txtAcctNo.Text.Trim(); appl1.bank.sort_code = txtSortCode.Text.Trim(); } theRequest.control = new control(); theRequest.strategy = new strategy(); theRequest.additionalclient = addlClient; theRequest.applicant1 = appl1; theRequest.addresses = addrs; return(theRequest); }
private string GetRequestXMLAsString(RequestState req, string AppID) { string request = string.Empty; ds_request theRequest = null; string head = @"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.decisionmetrics.co.uk/xsd""> <soapenv:Header/> <soapenv:Body> <xsd:ServiceRequest> <xsd:name>ATOMUATAPI</xsd:name> <xsd:password>atomuatpwd</xsd:password> <xsd:service>Atom_Savings</xsd:service> <xsd:processflow_id>55750</xsd:processflow_id> <!--Optional:--> <xsd:payload><![CDATA["; string tail = @"]]></xsd:payload> </xsd:ServiceRequest> </soapenv:Body> </soapenv:Envelope>"; theRequest = BuildRequestObject(); if (req != RequestState.IDCheck && !string.IsNullOrEmpty(AppID)) { theRequest.control.request_type = "UPDATE"; theRequest.control.application_id = AppID; } var serializer = new XmlSerializer(typeof(ds_request)); using (StringWriter textWriter = new StringWriter()) { serializer.Serialize(textWriter, theRequest); request = head + textWriter.ToString() + tail; } return(request); }