Please tell me there is an example XML file. What is the easiest way to create XML for a POST request based on this example?

<?xml version="1.0" encoding="Windows-1251" ?> <product> <prequest> <req> <AddressReq> <street>Горького</street> <houseNumber>1</houseNumber> <apartment>38</apartment> <city>Магадан</city> <postal>685000</postal> <addressType>1</addressType> </AddressReq> <AddressReq> <street>Цветочная</street> <houseNumber>5</houseNumber> <block>11</block> <apartment>143</apartment> <city>Магадан</city> <postal>685000</postal> <addressType>2</addressType> </AddressReq> <IdReq> <idNum>273412</idNum> <idType>21</idType> <seriesNumber>6439</seriesNumber> <issueCountry>г. Магадан</issueCountry> <issueDate>2006-03-18</issueDate> <issueAuthority>ОВД Центральное, к/п 255</issueAuthority> </IdReq> <InquiryReq> <ConsentReq> <consentFlag>Y</consentFlag> <consentDate>2016-01-20</consentDate> <consentExpireDate>2021-10-21</consentExpireDate> <consentPurpose>4</consentPurpose> <otherConsentPurpose>Job pre-screening</otherConsentPurpose> <reportUser>DG Human Resources Incorporated</reportUser> <liability>Y</liability> </ConsentReq> <inqPurpose>01</inqPurpose> <inqAmount>10000</inqAmount> <currencyCode>USD</currencyCode> </InquiryReq> <PersonReq> <name1>Фамилия</name1> <first>Георгий</first> <paternal>Отчество</paternal> <gender>1</gender> <birthDt>1946-07-06</birthDt> <placeOfBirth>Москва</placeOfBirth> </PersonReq> <RequestorReq> <MemberCode>0000BB000000</MemberCode> <UserID>0000BB000001</UserID> <Password>password</Password> </RequestorReq> <RefReq> <product>CHST</product> </RefReq> <IOType>B2B</IOType> <OutputFormat>XML</OutputFormat> <lang>ru</lang> </req> </prequest> </product> 
  • Does the post request have a GetRequestStream method correctly (see an example of sending a POST request)? Transfer xml there. - nick_n_a
  • Probably not correctly expressed. I have an xml file, they gave it to me. And I need to create the same xml file format. And here is the plug. - Andrey Sherman
  • one
    Then 1) create a byte[] array, do requestStream.read into an array, and then fileStream.Write. 2) in the version of NET 4.0 appeared CopyTo msdn.microsoft.com/en-us/library/dd782932(v=vs.110).aspx open the file for writing and make RequestStream.CopyTo. PS RequestStream position should be set to RequestStream.Position = 0 before copying. Found stackoverflow.com/questions/2934295/… solution - nick_n_a
  • one
    The easiest way to create xml is with XElement . - Alexander Petrov

0