Reputation: 21
I need to write a wcf service that accepts 3rd party applications to send a xml file to the wcf service.
An example of a xml file could be:
<?xml version="1.0" standalone="yes"?>
<Customers>
<Customer>
<ID>1</ID>
<Name>Name 1</Name>
</Customer>
<Customer>
<ID>3</ID>
<Name>Name 3</Name>
</Customer>
</Customers>
How do I setup the wcf service to accept this collection of data?
Upvotes: 2
Views: 1783
Reputation: 8645
This would be one way, it allows you to HTTP POST a non-soap formatted, untyped request to the service at the address http://<your-url>/<your-service-name>/ReceiveCustomers
[WebInvoke(UriTemplate = "ReceiveCustomers", Method = "POST", RequestFormat=WebMessageFormat.Xml, BodyStyle=WebMessageBodyStyle.Bare]
[XmlSerializerFormat]
public void ReceiveCustomer(XElement customers)
{
....
}
Upvotes: 4