WDDX and structures

2001-09-24 Thread cftalk

Hello all,
My first post to the group - hopefully not asking questions that will send 
eyes rolling.

Situation:
I'm trying to pass a structure of items from an application to the secure 
portion of the site to complete checkout/ordering process. The main site 
sits at http://www.foo.com and the secure portion is on the same server but 
at a different domain http://secure.isp.com/foo  - obviously, session 
variables won't exist from one site to the next so I'm looking at options 
for passing the shopping cart structure and a session id#.
I could write to a temporary database prior to leaving www.foo.com, then 
querying said database and re-initializing the needed variables on 
secure.isp.com/foo but I'm wondering if that's the best approach.
Research brought me to the doorstep of WDDX (cfwddx) and it seems like 
that it *should* work ideally for avoiding database write/reads. Great!

Problem:
I've been exploring code snippets and examples for just how to achieve the 
results and I'm stumped - I've had some luck in creating the WDDX packet 
and can output it's contents for testing using htmleditformat() but I can't 
figure out how to actually loop through the packet and breakout the 
variables for use on the secure portion of the site.

Questions:
1. Is using WDDX the better approach for accomplishing my task or should I 
give up and just write to the db?
2. Is anyone doing what I'm attempting and, if so, could you demonstrate 
how your code works for me? Please?
3. Is there another approach that I should be aware of instead?

Add'l info:
* I've RTFM - and site after site, post after post still grasping...
* The packet is only needed one-way (from main site to secure) and will be 
discarded after pulling out the variables for secure processing. I don't 
know if that makes any diff or not
* There is a total of 9 variables that exist in the session structure:
category
id
name
number
personalized
price
qty
weight

session id#

* Each variable can/will contain several items (except for session id#):
id: 23, 356, 698
name: foo1, foo2, foo3
etc...

* I'd provide code that I'm using but there really isn't anything more 
than just some test code at this point. Sorry.


I await all responses and hope that some wise soul can help guide me to my 
goal.your time is appreciated and I thank you in advance.


Stumped,
John Ramsey
[EMAIL PROTECTED]

FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: WDDX and structures

2001-09-24 Thread Alistair Davidson

John,

To encode (serialize) a structure into WDDX -

CFWDDX action=CFML2WDDX input=#MyStructure# output=MyWDDXPacket

will create a string called MyWDDXPacket with the WDDX encoding of
MyStructure.

To get it back (de-serialize) -

CFWDDX action=WDDX2CFML input=#myWDDXPacket# output=MyNewStructure

will create a structure called MyNewStructure that should be an EXACT
duplication of the original variable.

You can then loop round the structure and convert it's keys into simple
values like this -

cfloop collection=#myNewStructure# item=key
cfset #key# = myNewStructure[key]
/cfloop

So if your structure was 

SESSION
-category
-id
-name
-number
-personalized
-price
-qty
-weight
-session id 

you'll then get simple values (un-scoped) called

category
id
name
number
personalized
price
qty
weight
session id

hope that helps

Alistair Davidson
Senior Developer
Rocom New Media
www.rocomx.net
There is no spoon

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 24 September 2001 15:12
To: CF-Talk
Subject: WDDX and structures


Hello all,
My first post to the group - hopefully not asking questions that
will send 
eyes rolling.

Situation:
I'm trying to pass a structure of items from an application to the
secure 
portion of the site to complete checkout/ordering process. The main site 
sits at http://www.foo.com and the secure portion is on the same server but 
at a different domain http://secure.isp.com/foo  - obviously, session 
variables won't exist from one site to the next so I'm looking at options 
for passing the shopping cart structure and a session id#.
I could write to a temporary database prior to leaving www.foo.com,
then 
querying said database and re-initializing the needed variables on 
secure.isp.com/foo but I'm wondering if that's the best approach.
Research brought me to the doorstep of WDDX (cfwddx) and it seems
like 
that it *should* work ideally for avoiding database write/reads. Great!

Problem:
I've been exploring code snippets and examples for just how to
achieve the 
results and I'm stumped - I've had some luck in creating the WDDX packet 
and can output it's contents for testing using htmleditformat() but I can't 
figure out how to actually loop through the packet and breakout the 
variables for use on the secure portion of the site.

Questions:
1. Is using WDDX the better approach for accomplishing my task or
should I 
give up and just write to the db?
2. Is anyone doing what I'm attempting and, if so, could you
demonstrate 
how your code works for me? Please?
3. Is there another approach that I should be aware of instead?

Add'l info:
* I've RTFM - and site after site, post after post still
grasping...
* The packet is only needed one-way (from main site to secure) and
will be 
discarded after pulling out the variables for secure processing. I don't 
know if that makes any diff or not
* There is a total of 9 variables that exist in the session
structure:
category
id
name
number
personalized
price
qty
weight

session id#

* Each variable can/will contain several items (except for session
id#):
id: 23, 356, 698
name: foo1, foo2, foo3
etc...

* I'd provide code that I'm using but there really isn't anything
more 
than just some test code at this point. Sorry.


I await all responses and hope that some wise soul can help guide me
to my 
goal.your time is appreciated and I thank you in advance.


Stumped,
John Ramsey
[EMAIL PROTECTED]

FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists