DataProcessor - Uncaught TypeError


#1

I tried to integrate Scheduler but some error occur as below.
image

[Html part]
//data saving
var dp = new dataProcessor("/API/Index/TestXML");
dp.init(scheduler);
dp.setTransactionMode(“POST”, false);

[Web API with C#]
public object TestXML()
{
string XML = " “;
XML = XML + “<action type=”” sid=“1” tid=“1”>";
XML = XML + “”;
return new HttpResponseMessage()
{
Content = new StringContent(XML, Encoding.UTF8, “application/xml”)
};
}

Something I Miss?
Could any body solve this issue or show me example?
Thanks.


#2

Hi @Suran_Yang

The issue can be related to incorrect generated XML file. Try to replace it with JSON:

var result = new
{
    action= "updated",
    sid= 1,
    tid= 1
};
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

return new HttpResponseMessage()
{
    Content = new StringContent(serializer.Serialize(result), Encoding.UTF8, "application/json")
};

Also, I should note that action and sid are not required in recent Scheduler versions, tid is required only in Inserted action.