简体   繁体   中英

How do i create a webservice that recieves XML?

I need to build a web service that accepts XML data.

The XML will send as the below example :

<Person>
<LegalName>
  <FirstName>Ralph</FirstName>
  <LastName>Anderson</LastName>
  <PhoneticFirstName>rah-lf</PhoneticFirstName>
</LegalName>
<SSN>122-34-1232</SSN>
<Demographics>
  <Sex>male</Sex>
  <Height>502</Height>
</Demographics>
<DriversLicense>
  <DriversLicenseNumber>1234</DriversLicenseNumber>
  <IssuingState>CA</IssuingState>
</DriversLicense>

My understanding is I need to write something like this:

public Service () {

    [WebMethod]
    public void CreateRecord(XmlDocument newRecord)
    {
        // do stuff
    }
}

How I can do that?

您可以尝试了解它的工作原理并在此处找到一篇不错的文章: https : //msdn.microsoft.com/en-us/library/hh534080.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM