I currently have a script that I am trying to use to access an api that works fine in my browser (navigate to http://zulutrade.com/TradeHistoryIndividual.aspx?pid=24508 to see it working by viewing the XHR requests in developer tools when you change the number of trades visible in the trade history).
My code is as follows:
function getHistory() {
var wsdl = SoapService.wsdl("http://zulutrade.com/WebServices/Performance.asmx?WSDL");
var performanceService = wsdl.getService("PerformanceWebService");
var param = Xml.element("GetProviderTrades", [
Xml.attribute("xmlns", "http://zulutrade.com/WebServices/Performance.asmx?WSDL"),
Xml.element("start",["0"]),
Xml.element("length",["100"]),
Xml.element("sortBy",["dc"]),
Xml.element("sortAscending",[false]),
Xml.element("providerId",["24508"]),
Xml.element("currencyIds",["[]"]),
Xml.element("fromDateStr",["1984-04-24"]),
Xml.element("toDateStr",["2011-09-10"]),
Xml.element("validTrades",[true]),
Xml.element("lotSize",["2"])
]);
var result = performanceService.invokeOperation("GetProviderTrades", [param]);
Logger.log(result);
}
I have copied the params from the payload data that I see in my browser, but I am getting the following error:
Request failed for http://zulutrade.com/WebServices/Performance.asmx returned code 500. Server response: soap:ServerServer was unable to process request. ---> There was an error generating the XML document. ---> <>f__AnonymousTypee`2[System.Int32,Z.T[]] cannot be serialized because it does not have a parameterless constructor. (line 21)
Can anyone shed any light on what I am doing wrong? Do I need to supply some kind of header data (maybe a cookie or something)?
Thanks!