How would the lists.asmx service be used to add an attachment to a list item with JavaScript File API?
I cannot find an example of anything other than copy.asmx for adding documents.
Update: Here is the code I am using. I have tried the FQDN of the server and the short form as in the code. I'm not sure what is going on but the error is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring>
<detail>
<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.</errorstring>
<errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x8102006d</errorcode>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Code sample:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>MarketNeed</listName>
<listItemID>1</listItemID>
<fileName>test.txt</fileName>
<attachment>dGVzdA==</attachment>
</AddAttachment>
</soap:Body>
</soap:Envelope>
var soapPayload = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/"><listName>MarketNeed</listName><listItemID>1</listItemID><fileName>test.txt</fileName><attachment>dGVzdA==</attachment></AddAttachment></soap:Body></soap:Envelope>';
$.ajax({
url: "http://dev/sites/plm/_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapPayload,
complete: function(){ console.log("Done"); },
contentType: "text/xml; charset=\"utf-8\""
});