我創建了一個站點,我有一個支付網關,我想要集成,我需要的是將一些我的c#元素傳遞給Web服務,我需要輸出一個xml文件與我的元素。 請問我該怎麼做?如何使用c#元素輸出xml
需要被髮送的請求如下:
<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