'Inteligenty' dom ze sterownikiem PLC

 Language:
Szukanie zaawansowane  

Aktualności:

Powrót do strony głównej: www.edom-plc.pl

Autor Wątek: Test connection problem  (Przeczytany 11403 razy)

meskas

  • Newbie
  • *
  • Wiadomości: 6
    • Zobacz profil
Test connection problem
« dnia: Stycznia 15, 2013, 08:02:52 am »

Hi,
maybe you can help me with jquery problem?
When i run test connections script i get this error in Google chrome console.
XMLHttpRequest cannot load http://192.168.1.1/READPI. Origin null is not allowed by Access-Control-Allow-Origin.
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #1 dnia: Stycznia 15, 2013, 08:40:07 am »

Hello,

It is a know issue related to same-origin-policy not to WAGO.  Here is an article explaining what to do:

http://www.edom-plc.pl/index.php?option=com_content&view=article&id=82:problemy-z-poczeniem&catid=37:wizualizacjehtml&Itemid=74&lang=en

Good luck!
Zapisane

meskas

  • Newbie
  • *
  • Wiadomości: 6
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #2 dnia: Stycznia 15, 2013, 08:49:47 am »

Still getting same problem...
Tried to add test connection script to wago and it works, but that PLC doesn't have required space for all web page...
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #3 dnia: Stycznia 15, 2013, 10:38:23 am »

Zapisane

meskas

  • Newbie
  • *
  • Wiadomości: 6
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #4 dnia: Stycznia 15, 2013, 01:22:07 pm »

Fixed the problem :)
just added (dataType: 'jsonp') to ajax call, but them the output info must be parsed in different way
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #5 dnia: Stycznia 15, 2013, 03:06:16 pm »

I'm glad

Pls share the code once you get it working
Zapisane

meskas

  • Newbie
  • *
  • Wiadomości: 6
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #6 dnia: Stycznia 16, 2013, 08:39:46 am »

I will post my code here,
but now i have trouble with WRITEPI... i can't get it to write value to my PLC i can use READPI and i read it normally.

When i use ajax call i get WRITEPI status 302 redirected.... maybe you have some ideas?
« Ostatnia zmiana: Stycznia 16, 2013, 08:42:49 am wysłana przez meskas »
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #7 dnia: Stycznia 16, 2013, 10:42:51 am »

Hi,

I have never had such a problem.  What code do you use now to read/write from/to WAGO?
Zapisane

meskas

  • Newbie
  • *
  • Wiadomości: 6
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #8 dnia: Stycznia 16, 2013, 12:53:50 pm »

Solved my mystery of write :) looked at your code and saw that in WRITE you need to use ADR1 VALUE1 FORMAT1 in READ  you just use ADR and FORMAT, now working on jsonp data parsing, so i will post my read and write codes here :)
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #9 dnia: Stycznia 17, 2013, 09:27:19 am »

Hi,

I am very curious, how you got around the SOP restriction.  I analyzed JSNOP before but thought that access to the response file from the server is neccessary.  I will be happy to see that information to be wrong! 
Zapisane

meskas

  • Newbie
  • *
  • Wiadomości: 6
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #10 dnia: Stycznia 17, 2013, 10:38:46 am »

Yeah... i failed with JSON... :)
Android was able to do it without JSON, but my browsers still hang with cross browsing....
So now it is a long way to code it on my pc then to upload to Android and then to test it...
Zapisane

admin

  • Administrator
  • Sr. Member
  • *****
  • Wiadomości: 313
    • Zobacz profil
Odp: Test connection problem
« Odpowiedź #11 dnia: Stycznia 17, 2013, 11:02:36 am »

...but then the original file should be just fine.  It works well on Android (see the source file of the Android App, link at the bottom), but fails on PC unless you use Chrome with the --disable-web-security option (browser restart neccessary)... So all my work is done on PC, almost no testing on Android device.
Zapisane