Jump to content

coenenp

Members
  • Content Count

    14
  • Joined

  • Last visited

About coenenp

  • Rank

Profile Information

  • Gender
    Male
  • Location
    Belgium
  1. coenenp

    TstringList properties and JSON.parse

    Hello Arnaud, I had to read your reply a couple of times (out of my league). Correct I did and it works. Ok .. not yet, I assumed it was available. Not so good news. I'll try the second. I'have your unit as an example. Thank You for your reply. Now I know at least why it didn't work.
  2. Hello, I'm using TW3HttpRequest to get a Json data string from a delphi indy http server. The request works and I'm receiving serialized data. I'm using SvSerializer in my Delphi Application. This seems to work for integer and boolean published properties. I'm having a problem with TStringList properties. This is my test class: TMyClass = Class Private FPublished: Boolean; FObjId: Integer; FRuleList: TStringList; procedure SetRuleList(const Value: TStringList); Public aPublic: Boolean; Constructor Create; Virtual; Destructor Destroy; Override; Published Property ObjId: Integer Read FObjId; Property aPublished: Boolean Read FPublished Write FPublished; Property RuleList: TStringList read FRuleList write SetRuleList; End; Constructor TMyClass.Create; Begin Inherited Create; // Default Var FObjId := 1000; FPublished := true; FRuleList := TStringList.Create; End; Destructor TMyClass.Destroy; Begin // Free Var FRuleList.Free; Inherited Destroy; End; The ResponseText of the TW3HttpRequest in SMS: {"ObjId":1000,"aPublished":true,"RuleList":["WIN - WIN","FTP - WIN","SFTP - WIN","WIN - SMTP","POP3 - WIN","Michel mxf & xml","PGP Encrypt","PGP Decrypt","WIN - ZIP","John","WIN - WIN","FTP - WIN","IMAP - WIN","HTTP - WIN","WIN - WIN MARY","WIN - UNZIP","Oldest","Keith","SFTP Check","Luis","Wayne","Justin","Noti Error","Concat","Speed Test","TV - Tolly","Split Output","Copy Emty Dir","WIN - WIN 2","Jason","Don H.","Michael","Empty Win Dir","Subdir Filter","labs","AUTO - WIN"]} So in SMS I have the same test Class: TMyClass = class private public constructor create; virtual; published ObjId: Integer; aPublished: Boolean; RuleList: TstringList; End; implementation constructor TMyClass.Create; begin inherited create; RuleList := TStringList.Create; end; Then the parse on http data ready: procedure TfrmMain.HandleHttpDataReady(Sender:TW3HttpRequest); Var tmpStr: String; tmpClass: TMyClass; begin (* Document is downloaded, now display the text in our memo *) tmpStr := FHttp.ResponseText; tmpClass := TMyClass.Create; try asm @tmpClass = JSON.parse(@tmpStr); end; try mmJsonData.Text := tmpClass.ObjId.tostring; mmJsonData.Text := mmJsonData.Text + #13#10 + tmpClass.aPublished.ToString; mmJsonData.Text := mmJsonData.Text + #13#10 + tmpClass.RuleList.text; except mmJsonData.Text := mmJsonData.Text + #13#10 + 'not good'; end; finally tmpClass.Free; End; //mmJsonData.Text := FHttp.ResponseText; end; The result is: 1000 True not good It seems that the JSON.parse doesn't work for TStringList properties. Am I doing something wrong here? Advice much appreciated, Pascal
  3. coenenp

    Some remarks regarding the SMS IDE

    Some remarks regarding the SMS IDE: - Zip entire project doesn't update the the .sproj file in the zip once it exists. So i lost some code because I thought that I could use my latest zip as a backup. - I found the TW3Timer in the unit 'SmartCL.Time'. Would be nice if this one would be available as a component. - Writing wrong asm code results in a blcak screen at startup. For example: asm @tmpStr := JSON.stringify(@tmpClass); end; (instead of asm @tmpStr = JSON.stringify(@tmpClass); end;) gives a black screen without any information. Best Regards, Pascal
  4. coenenp

    TW3HttpRequest issue

    Hmm I can't upload anymore ...
  5. coenenp

    TW3HttpRequest issue

    Ok did some more test work and have found something. It seems that Chrome, due to the app.manifest file?, caches the index.html and res/app.css. When it does this then the whole TW3HttpRequest doesn't work (not when streamed from 127.0.0.1:8080 and also not when streamed from 192.168.2.109:8080). It had to clear the cache and prevent it from caching again to get it to work (chrome://appcache-internals/). In the next reply I'll add the screenhots where I prevent Chrome from caching these files. In this case everything works as normal. I can do a TW3HttpRequest to 127.0.0.1, 192.168.2.109 and also to date.jsontest.com without any problem. When I stop my delphi application then the index.hml from 127.0.0.1:8080 is no longer available (it isn't cached). Now can somebody explain why a TW3HttpRequest from a cached index.html file doestn't work? Best Regards, Pascal
  6. coenenp

    TW3HttpRequest issue

    I've added: 'Access-Control-Allow-Origin: *' to the indy http server respons (you can see this in the screenshot - Respons info). Without this line even none of the above works (like you also discovered). It seems that when using the index.html from http://127.0.0.1:8080/index.htmlthen TW3HttpRequest isn't fired. I certainly don't get a trigger in the OnCommandGet from the indy httpserver and there seems to be something wrong with the headers when the request is triggered.
  7. coenenp

    TW3HttpRequest issue

    I've added some debug screenshots (network - headers) from the Chrome browser. It seems that there is something wrong with the http request when the index.html is coming from the localhost 127.0.0.1. This information is generated after the onclick event of the button asking a httprequest from http://127.0.0.1:8080/1 It's is completely different with the one from http://192.168.2.109:8080/index.html
  8. coenenp

    TW3HttpRequest issue

    Some extra information. The Indy http server has no fixed IP bindings and is using the local host IP 127.0.0.1 and the newtwork IP 192.168.2.109 So I decided to open the index.html file using http://192.168.2.109:8080/index.html(instead of http://127.0.0.1:8080/index.html) The result is that it works now and I've add an extra button on my form so now I can do a TW3HttpRequest from http://127.0.0.1:8080/1and from http://192.168.2.109:8080/1. Both work (when I get the index.html file from http://192.168.2.109:8080/index.html). Now I don't understand why it doesn't work when the index.html file is streamed from 127.0.0.1. It can't be the Indy http server part because it works with 192.168.2.109.
  9. coenenp

    TW3HttpRequest issue

    Hello Andre, Still not working. I found some information here about how to stream the html file. I also tried your advice. http://delphi-kb.blogspot.be/2011/05/creating-simple-http-server.html When I compare the html code (using Chrome) then the one from the indy http server (streamed) is exactly the same as the one where i directly loaded the index.html file in chrome. I don't understand why the TW3HttpRequest fails if the index.html is coming from the indy http server. I debugged the indy http server and noticed the following: - The OnCommandGet event gets triggered on the chrome request for the index.hmtl file - The OnCommandGet event isn't triggered on the TW3HttpRequest from the 'streamed' index.html file => error: GET http://127.0.0.1:8080/1 net::ERR_FAILED - The OnCommandGet event gets triggered on the TW3HttpRequest from the in chrome locally loaded index.html file Any idea? Best Regards, Pascal
  10. coenenp

    Black Screen

    Hi, No longer using the component events from the IDE but adding them through code. This seems to work and I haven't had an issue since. Best Regards, Pascal
  11. coenenp

    TW3HttpRequest issue

    Hello, What I'm working on is the following. - Delphi application with Indy http server - the index.html file created by SMS is streamed through the indy http server so that a user can access this index.html file using his browser (http://127.0.0.1:8080/index.html) - The created index.html file by SMS is form with a button and a memo (simple test application). - A click on the button will try to that will do a TW3HttpRequest to the same delphi application with the same indy http server Strange here is that it works when I run the index.html from the internal SMS browser but not when the index.html is streamed to a browser. I did a test with Chrome and Firefox. So when running from the internal SMS browser I can do a http request to the indy http server (http://127.0.0.1:8080/1) and I get a reply. Also when I open the index.html file directly using chrome it also works. But not when it's streamed from the same http server as the one where I want to get the http request from. Screenshot attached. Best Regards, Pascal
  12. coenenp

    Black Screen

    Screenshot attached. Can you explain please why this is possible? It makes the software really unusable.. Regards, Pascal
  13. coenenp

    Black Screen

    Hello Christian, Thank you for your fast reply. So it seems that the IDE creates a corrupt sproj file. This and the fact that a simple thing like an onclick event of a button can't be used .. means (for me) that this product isn't ready. I really hope that you guys get this a bit more stable asap. In the meanwhile I'll have to wait. It's a pity. Best Regards, Pascal
  14. coenenp

    Black Screen

    Hello, Using the latest version of SMS. I'm new to SMS and having several strange issues. It seems that button events loose their internal link to their procedure code after a restart of SMS. So often after a restart of SMS a new OnClick procedure is generated while this one is already available. Then when I try to remove this and I recompile the project all I get is a black screen. I started with a new project and after a while I got the same issue. I've attached my test project that compiles without an error but gives me a black screen. Advice much appreciated. It seems that button Onclick events can't be used at the moment. But why the black screen? Best Regards, Pascal LimagitoXI.zip
×