[Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data from external script
Paul Swanson
Paul.Swanson at harlandfs.com
Tue Aug 7 18:29:26 BST 2012
Latest update: I created a stripped down version that just takes the user's text entry email address and sends it to the PHP script, and reads the response from the onSendAndLoadVars event as rawData. It's working in my stripped down version on localhost. One difference: instead of trying to display the rawData (I haven't attempted any parsing yet) in the script attached to the event response, I'm exiting the response and then doing my textIconID.appendText(rawData) -- I'll let you know if moving my parsing routine to a script following the interaction resolves the problem in my full application.
Paul Swanson
Internal Business Systems Analyst
Internal Business Intelligence
Harland Financial Solutions
(800) 274-7280 Ext. 2462
Paul.Swanson at harlandfs.com
-----Original Message-----
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: Tuesday, August 07, 2012 7:56 AM
To: Xerte discussion list
Subject: [Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data from external script
It's got to be security: preview isn't subject to any security restrictions. It works there, right? So you know the xerte code is fine.
Can you make a simple stripped down example that just does the sendAndLoadVars thing and share the files? If it were me I'd do that, put the rlo and the php in the same folder ona webserver and try it again, then I'd debug in the engine to see if the data is coming back, and what gets returned, any errors, etc.
-----Original Message-----
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Paul Swanson
Sent: 07 August 2012 15:52
To: Xerte discussion list
Subject: [Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data from external script
I've tried it on our live server, and get the same 'undefined' issue.
Paul Swanson
Internal Business Systems Analyst
Internal Business Intelligence
Harland Financial Solutions
(800) 274-7280 Ext. 2462
Paul.Swanson at harlandfs.com
-----Original Message-----
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Pat Lockley
Sent: Tuesday, August 07, 2012 7:49 AM
To: Xerte discussion list
Subject: [Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data from external script
try a webserver that isn't localhost?
On Tue, Aug 7, 2012 at 3:46 PM, Dave Burnett <d_b_burnett at hotmail.com> wrote:
>
> Shouldn't be as it's using an event.
>
>
>
>
>> Date: Tue, 7 Aug 2012 15:43:35 +0100
>> From: patrick.lockley at googlemail.com
>> To: xerte at lists.nottingham.ac.uk
>
>> Subject: [Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data
>> from external script
>>
>> Timing issue?
>>
>> On Tue, Aug 7, 2012 at 3:41 PM, Paul Swanson <Paul.Swanson at harlandfs.com>
>> wrote:
>> > Same thing.
>> >
>> >
>> >
>> > Paul Swanson
>> >
>> > Internal Business Systems Analyst
>> >
>> > Internal Business Intelligence
>> >
>> > Harland Financial Solutions
>> >
>> > (800) 274-7280 Ext. 2462
>> >
>> > Paul.Swanson at harlandfs.com
>> >
>> >
>> >
>> > From: xerte-bounces at lists.nottingham.ac.uk
>> > [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
>> > Sent: Monday, August 06, 2012 5:01 PM
>> > To: Xerte list
>> > Subject: [Xerte] Re: Desktop Xerte 2.17 -- having trouble reading data
>> > from
>> > external script
>> >
>> >
>> >
>> > What if it's on an actual web server?
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ________________________________
>> >
>> > From: Paul.Swanson at harlandfs.com
>> > To: xerte at lists.nottingham.ac.uk
>> > Date: Mon, 6 Aug 2012 22:39:53 +0000
>> > Subject: [Xerte] Desktop Xerte 2.17 -- having trouble reading data from
>> > external script
>> >
>> > I'm have a devil of a time getting a Xerte app to read the response from
>> > a
>> > PHP script when run through a browser. It works fine in Preview mode,
>> > and I
>> > know the script is getting the login information and returning a string
>> > because in preview mode I receive and can display the correct response
>> > with
>> > info from my database. I also have the PHP database script email me the
>> > same
>> > string. This works beautifully in Preview mode, but when I copy my rlo
>> > and
>> > other published files to localhost and run it from there, Xerte prints
>> > 'undefined' for the rawData property returned from a sendAndLoadVars
>> > call.
>> > The database script still emails me the correct response.
>> >
>> >
>> >
>> > Here's what I'm sending to my PHP authentication script (domain is
>> > defined
>> > in a login script, and the parent Page icon has an id of loginCheck):
>> >
>> > // real url
>> >
>> > URLString = domain + '/wbt/app/admin/authenticate.php';
>> >
>> >
>> >
>> > // pass values to external script
>> >
>> > loginVars = new LoadVars ();
>> >
>> > loginVars.action = 'authenticate';
>> >
>> > loginVars.login = username;
>> >
>> > loginVars.sku = sku;
>> >
>> >
>> >
>> > // send to login script
>> >
>> > loginCheck.sendAndLoadVars(URLString, loginVars);
>> >
>> >
>> >
>> > Following the above, I have an Interaction with an Event icon (eventName
>> > =
>> > onSendAndLoadVars, icon = loginCheck). Attached to the event is a script
>> > icon with:
>> >
>> > // initialize btnPath -- assume not authenticated
>> >
>> > btnPath = 1; // 1 is the fail path
>> >
>> > message = ''; // initialize message
>> >
>> > responseMessage = ''; // initialize response message
>> >
>> >
>> >
>> > rawStuff = loginCheck.rawData;
>> >
>> > loginInstructions.setText(loginCheck.rawData);
>> >
>> >
>> >
>> > //rawStuff = replace(rawStuff, '<sup>®</sup>', '');
>> >
>> > rawInfoArray = rawStuff.split('&'); // save string pairs into an array
>> >
>> >
>> >
>> > for (i = 0; i < rawInfoArray.length; i++) { // break pairs into smaller
>> > arrays and parse
>> >
>> >
>> >
>> > tempArray = rawInfoArray[i].split('='); // split on = sign
>> >
>> >
>> >
>> > switch (tempArray[0]) {
>> >
>> > case 'reg_id':
>> >
>> > sid = tempArray[1];
>> >
>> > btnPath = 0;
>> >
>> > break;
>> >
>> > case 'message':
>> >
>> > responseMessage = tempArray[1];
>> >
>> > break;
>> >
>> > }
>> >
>> >
>> >
>> > }
>> >
>> >
>> >
>> > debug('sid: ' + sid + '\nresponseMessage: ' + responseMessage);
>> >
>> > debug(loginCheck.rawData);
>> >
>> >
>> >
>> > // display appropriate response
>> >
>> > if (btnPath == 1) {
>> >
>> > message = '<p>Could not retrieve account from the database.</p><br
>> > /><p>'
>> > + responseMessage + '</p>';
>> >
>> > }
>> >
>> >
>> >
>> > I get all the expected debug info in Preview and login is successful.
>> > Debug
>> > response is:
>> >
>> > sid: 71
>> >
>> > responseMessage: User Found in Database<br/>
>> >
>> >
>> >
>> > reg_id=71&message=User Found in Database<br/>
>> >
>> >
>> >
>> > 0
>> >
>> >
>> >
>> > Any ideas would be appreciated.
>> >
>> >
>> >
>> > Paul Swanson
>> >
>> > Internal Business Systems Analyst
>> >
>> > Internal Business Intelligence
>> >
>> > Harland Financial Solutions
>> >
>> > (800) 274-7280 Ext. 2462
>> >
>> > Paul.Swanson at harlandfs.com
>> >
>> >
>> >
>> >
>> > This message and any attachment are intended solely for the addressee
>> > and
>> > may contain confidential information. If you have received this message
>> > in
>> > error, please send it back to me, and immediately delete it. Please do
>> > not
>> > use, copy or disclose the information contained in this message or in
>> > any
>> > attachment. Any views or opinions expressed by the author of this email
>> > do
>> > not necessarily reflect the views of the University of Nottingham.
>> > This message has been checked for viruses but the contents of an
>> > attachment
>> > may still contain software viruses which could damage your computer
>> > system:
>> > you are advised to perform your own checks. Email communications with
>> > the
>> > University of Nottingham may be monitored as permitted by UK
>> > legislation.
>> >
>> > _______________________________________________ Xerte mailing list
>> > Xerte at lists.nottingham.ac.uk
>> > http://lists.nottingham.ac.uk/mailman/listinfo/xerte This message and
>> > any
>> > attachment are intended solely for the addressee and may contain
>> > confidential information. If you have received this message in error,
>> > please
>> > send it back to me, and immediately delete it. Please do not use, copy
>> > or
>> > disclose the information contained in this message or in any attachment.
>> > Any
>> > views or opinions expressed by the author of this email do not
>> > necessarily
>> > reflect the views of the University of Nottingham. This message has been
>> > checked for viruses but the contents of an attachment may still contain
>> > software viruses which could damage your computer system: you are
>> > advised to
>> > perform your own checks. Email communications with the University of
>> > Nottingham may be monitored as permitted by UK legislation.
>> >
>> >
>> > _______________________________________________
>> > Xerte mailing list
>> > Xerte at lists.nottingham.ac.uk
>> > http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>> >
>> > This message and any attachment are intended solely for the addressee
>> > and
>> > may contain confidential information. If you have received this message
>> > in
>> > error, please send it back to me, and immediately delete it. Please do
>> > not
>> > use, copy or disclose the information contained in this message or in
>> > any
>> > attachment. Any views or opinions expressed by the author of this email
>> > do
>> > not necessarily reflect the views of the University of Nottingham.
>> >
>> > This message has been checked for viruses but the contents of an
>> > attachment
>> > may still contain software viruses which could damage your computer
>> > system:
>> > you are advised to perform your own checks. Email communications with
>> > the
>> > University of Nottingham may be monitored as permitted by UK
>> > legislation.
>> >
>> >
>>
>> _______________________________________________
>> Xerte mailing list
>> Xerte at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
> This message and any attachment are intended solely for the addressee and
> may contain confidential information. If you have received this message in
> error, please send it back to me, and immediately delete it. Please do not
> use, copy or disclose the information contained in this message or in any
> attachment. Any views or opinions expressed by the author of this email do
> not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>
>
> _______________________________________________
> Xerte mailing list
> Xerte at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
> This message and any attachment are intended solely for the addressee and
> may contain confidential information. If you have received this message in
> error, please send it back to me, and immediately delete it. Please do not
> use, copy or disclose the information contained in this message or in any
> attachment. Any views or opinions expressed by the author of this email do
> not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>
>
_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte
_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte
_______________________________________________
Xerte mailing list
Xerte at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte
More information about the Xerte
mailing list