Я создаю сайт, у меня есть шлюз оплаты, который я хочу интегрировать, все, что мне нужно, это передать некоторые из моих элементов C# в веб-службу, мне нужно вывести XML-файл с моими элементами. Как мне это сделать?Как вывести xml с помощью элементов C#
запрос, который должен быть отправлен следующим образом:
<PaymentRequest>
<ProductName>Match Ticket</ProductName> (Static value)
<Prefix>Mr</Prefix> (Prefix of the booker)
<FirstName>Test</FirstName> (First name of the user)
<LastName>Test</LastName> (Last name of the user)
<Address>Test Address</Address> Address of the user(can be a dummy value in case the customer did not fill this)
<City>London</City> City of user(can be a dummy value in case the customer did not fill this)
<Country>UK</Country> Country of user(can be a dummy value in case the customer did not fill this)
<Mobile>98231283123</Mobile> (user phone no)
<EmailId>[email protected]</EmailId> (user email)
<PaymentMethod>PayatBank</PaymentMethod> (this will be the option selected)
<TotalAmount>13314</TotalAmount> (total amount, this is already a label)
<Amount>12926</Amount> (Base amount of the booking)
<GatewayCharge>388</GatewayCharge> (Credit card charges)
<GatewayChargeInPercent>3</GatewayChargeInPercent>
<CallBackURL>http://www.google.com</CallBackURL> Link where the user will get redirected after the payment has been made. This will be used for online payments only.
</PaymentRequest>
Вы можете создать класс 'PaymentRequest' и сериализовать его с помощью [' XmlSerializer'] (http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer (v = vs.110) .aspx) –
Спасибо за ответ, вам нужно исследовать xmlserializer – Kenneth