Question

If this makes any difference, the XML file is being sent from a handheld device.

There are a couple of interesting answers to a similar question here, but I'm not sure the more popular answer really addresses my situation (where the client seems to be passing a custom type (ComputerInfo)) whereas in my case it is an actual XML file is the arg being passed.

The second answer looks perhaps more "up my alley/what the doctor ordered" but I don't know what signature my method should have. Something like this:

public async Task<HttpResponseMessage> PostXMLFile(XMLDocument xmlFile) {

?

Adding to my doubts is that the XMLDocument type is unrecognized, and there is no "Resolve" context menu item to formally introduce it to the project).

And, can a CF app deal with a returned Task anyway? I doubt it, so: what should my Web API method receiving an XML file look like?

Was it helpful?

Solution

Try this instead,

public async Task<HttpResponseMessage> PostXMLFile(XElement xElement) {

Whether you user the above signature or,

public HttpResponseMessage PostXMLFile(XElement xElement) {

the client will see exactly the same response. Use the first signature when you need to make an async request within your action method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top