Guest Joel P Report post Posted March 19, 2010 We are evaluating WAPT to load test a REST web service. A key requirement is to be able to POST large XML, JSON, etc. payloads. I see that I can paste text directly into the "POST raw data" field, but our payloads are too large and get truncated when I do this. It seems like I *should* be able to use the $File and perhaps $Var functions to request that I want a payload to be loaded from a file, but $File(application/xml, 'pathtofile') just results in that string being POSTed, which of course is rejected as an invalid request, and $Var($File(application/xml, 'pathtofile')) results in no payload at all. If I save $File(application/xml, 'pathtofile') to the variable 'myPayload' after the previous request, $Var(myPayload) also results in the raw string $File(application/xml, 'pathtofile') being POSTed, which of course is also not good. Can someone please explain to me either a) what I'm doing something wrong, or confirmation that WAPT lacks this ability, which would be a deal-killer for us. To be clear, if my file is named "foo.xml", and contains the XML <foo>12345</foo>, I want WAPT to produce a request like the following: POST /myapp/whatever HTTP/1.1 Content-Type: application/xml ... Connection: Keep-Alive <foo>12345</foo> =================== Currently the closest I can get is: POST /myapp/whatever HTTP/1.1 Content-Type: application/xml ... Connection: Keep-Alive $File(application/xml, 'foo.xml') =================== Any help would be greatly appreciated. -joel Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 23, 2010 It isn't possible in the current version. In the new version of WAPT Pro you can use JavaScript for loading XML from file. You can download beta from http://www.loadtestingtool.com/forum/builds/WAPTPro2.0.zip Quote Share this post Link to post Share on other sites
Guest Sreenadh OG Report post Posted March 29, 2010 Dear Sergei, //In the new version of WAPT Pro you can use JavaScript for loading XML from file.// Do you mean to say that I can use WAPT Javascript to read from my local hard disk? Can you provide with a code example and clarify please? Regards, Sreenadh It isn't possible in the current version. In the new version of WAPT Pro you can use JavaScript for loading XML from file. You can download beta from http://www.loadtestingtool.com/forum/builds/WAPTPro2.0.zip Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 30, 2010 Yes, you can read a data from a file and initialize a variable. For example, you can place the file to a network share, give an access to the file for Everyone (for remote Load Agents) and use following JavaScript code: var fso = new ActiveXObject("Scripting.FileSystemObject"); var file = fso.OpenTextFile("\\\\Server\\Share\\filename.txt", 1, false); context.variable("XML") = file.ReadAll();//You should create "XML" variable in advance Quote Share this post Link to post Share on other sites
Guest Sreenadh OG Report post Posted March 30, 2010 Dear Sergei, Do you want to say that, I can use the full power of WSH JScript coding from within WAPT? Or does WAPT Javascript provides limited features only? Regards, Sreenadh Yes, you can read a data from a file and initialize a variable. For example, you can place the file to a network share, give an access to the file for Everyone (for remote Load Agents) and use following JavaScript code: var fso = new ActiveXObject("Scripting.FileSystemObject"); var file = fso.OpenTextFile("\\\\Server\\Share\\filename.txt", 1, false); context.variable("XML") = file.ReadAll();//You should create "XML" variable in advance Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 31, 2010 Yes, you can use all that Windows Scripting Host can do. Quote Share this post Link to post Share on other sites
Guest Sreenadh OG Report post Posted April 6, 2010 Dear Sergei, Great! It would be great if you include a WSH JScript tutorial along with Wapt Pro 2.0 help. Just a suggestion (especially considering the fact that there is only very little info on the same available in net). Regards, Sreenadh Yes, you can use all that Windows Scripting Host can do. Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted April 7, 2010 We think about it. Quote Share this post Link to post Share on other sites