I'll post this as an answer as it's a bit hard to describe in comments
public HttpResponseMessage PostXMLFile(string serialNum, string siteNum, string xmlString)
{
var xElement = XElement.Parse(xmlString);
// do whatever now with your xElement;
}
Then you'd be able to call your method like:
http://<machineName>:<port>/api/<ControllerName>?serialNum=2&siteNum=7&xmlString=<xml bla bla </xml>
(though watch out for encoding)
As for adding the XML to your url, because it's just a string, you can just read it as normal text and append it to your url.
If you want to accept lists of elements, I believe you can change your controller method to
public HttpResponseMessage PostXMLFile(string serialNum, string siteNum, [ModelBinder]List<string> xmlStrings)
{
foreach(var xmlString in xmlStrings)
{
var xElement = XElement.Parse(xmlString);
// do whatever now with your xElement;
}
}
and your url will look something like
http://<machineName>:<port>/api/<ControllerName>?serialNum=2&siteNum=7&xmlStrings=<xml bla bla </xml>&xmlStrings=<xml more bla bla </xml>&xmlStrings=<xml even more bla bla </xml>
It doesn't quite make sense to me that you would want to load text from a file and then 'serialize' it to XML for wire transmission when both the file contents and xml are already serialized. You don't need to create any XDocuments or XElements until your controller method receives the xml string.