Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Matt McSpirit #1
Aeroflot Flight Web Service
Hi guys,
Im hoping someone can help, as im going out of my mind here! Ive managed to
invoke a flight status web service into my application, however, im having a
little trouble with the times of flights etc. Basically, upon invokin the web
service, it returns a complex type;
returnvariable="aFlightDetailArray"
Which i then convert all its items into a struct, which i can then work with:
<cfscript>
secondStruct = StructNew();
secondStruct.company = aFlightDetailArray[1].company;
secondStruct.flight_no = aFlightDetailArray[1].flight_no;
secondStruct.flight_type = aFlightDetailArray[1].flight_type;
secondStruct.aircraft_type = aFlightDetailArray[1].aircraft_type;
//secondStruct.bort = aFlightDetailArray[1].bort;
secondStruct.seats_f = aFlightDetailArray[1].seats_f;
secondStruct.seats_c = aFlightDetailArray[1].seats_c;
secondStruct.seats_y = aFlightDetailArray[1].seats_y;
secondStruct.sched_dep = aFlightDetailArray[1].sched_dep;
secondStruct.sched_arr = aFlightDetailArray[1].sched_arr;
secondStruct.plan_dep = aFlightDetailArray[1].plan_dep;
secondStruct.plan_arr = aFlightDetailArray[1].plan_arr;
secondStruct.fact_dep = aFlightDetailArray[1].fact_dep;
secondStruct.fact_arr = aFlightDetailArray[1].fact_arr;
secondStruct.real_dep = aFlightDetailArray[1].real_dep;
secondStruct.real_arr = aFlightDetailArray[1].real_arr;
secondStruct.calc = aFlightDetailArray[1].calc;
secondStruct.status = aFlightDetailArray[1].status;
secondStruct.city_dep = aFlightDetailArray[1].city_dep;
secondStruct.airport_dep = aFlightDetailArray[1].airport_dep;
secondStruct.code_dep = aFlightDetailArray[1].code_dep;
// secondStruct.terminal_dep = aFlightDetailArray[1].terminal_dep;
secondStruct.city_arr = aFlightDetailArray[1].city_arr;
secondStruct.airport_arr = aFlightDetailArray[1].airport_arr;
secondStruct.code_arr = aFlightDetailArray[1].code_arr;
// secondStruct.terminal_arr = aFlightDetailArray[1].terminal_arr;
secondArray[1] = secondStruct;
</cfscript>
All of which works perfectly, however, when i display the value of
secondStruct.sched_dep, it displays a timestamp fine, yet the timestamp it
displays is when the flight is scheduled to depart in my local time, Greenich
Mean Time, rathen than the local time it would be departing from. For example,
if a flight was departing from Malaga at 9:00Pm local time, the result it would
give me would be 8:00pm, as that is what the time is for me in the UK at that
departure time.
Can anyone tell me what is happening? Why is the timestamp being converted to
my timezone automatically?
I did a cfdump of the array returned from the web service, and got this:
(<cfdump var="#aFlightDetailArray#">) Please ignore the formatting.
array
1
object of ru.aeroflot.[url]www.FlightDetail[/url]
Methods
hashCode (returns int)
equals (returns boolean)
getStatus (returns java.lang.String)
setStatus (returns void)
getSerializer (returns interface org.apache.axis.encoding.Serializer)
getDeserializer (returns interface org.apache.axis.encoding.Deserializer)
getTypeDesc (returns org.apache.axis.description.TypeDesc)
getCompany (returns java.lang.String)
setCompany (returns void)
getFlight_no (returns java.lang.String)
setFlight_no (returns void)
getCalc (returns java.util.Calendar)
setCalc (returns void)
getFlight_type (returns java.lang.String)
setFlight_type (returns void)
getAircraft_type (returns java.lang.String)
setAircraft_type (returns void)
getBort (returns java.lang.String)
setBort (returns void)
getSeats_f (returns int)
setSeats_f (returns void)
getSeats_c (returns int)
setSeats_c (returns void)
getSeats_y (returns int)
setSeats_y (returns void)
getSched_dep (returns java.util.Calendar)
setSched_dep (returns void)
getSched_arr (returns java.util.Calendar)
setSched_arr (returns void)
getPlan_dep (returns java.util.Calendar)
setPlan_dep (returns void)
getPlan_arr (returns java.util.Calendar)
setPlan_arr (returns void)
getFact_dep (returns java.util.Calendar)
setFact_dep (returns void)
getFact_arr (returns java.util.Calendar)
setFact_arr (returns void)
getReal_dep (returns java.util.Calendar)
setReal_dep (returns void)
getReal_arr (returns java.util.Calendar)
setReal_arr (returns void)
getCity_dep (returns java.lang.String)
setCity_dep (returns void)
getAirport_dep (returns java.lang.String)
setAirport_dep (returns void)
getCode_dep (returns java.lang.String)
setCode_dep (returns void)
getTerminal_dep (returns java.lang.String)
setTerminal_dep (returns void)
getCity_arr (returns java.lang.String)
setCity_arr (returns void)
getAirport_arr (returns java.lang.String)
setAirport_arr (returns void)
getCode_arr (returns java.lang.String)
setCode_arr (returns void)
getTerminal_arr (returns java.lang.String)
setTerminal_arr (returns void)
getClass (returns java.lang.Class)
wait (returns void)
wait (returns void)
wait (returns void)
notify (returns void)
notifyAll (returns void)
toString (returns java.lang.String)
Now, for all the time related ones, it shows this: (returns java.util.Calendar)
What is the significance? Is this causing the time to be converted to my time?
Any help would be excellent,
Thanks guys,
Matt
Matt McSpirit Guest
-
Indesign to PDF (flight check)
I am having a Puzzling problem. We create a PDF file for a Job done in Indesign with Tiff files and EPS files in it. When we create the PDF file... -
Simple Flight Sim
hello I have been messing with Gary Rosenzweig's simple flight sim I wanted to load up one of my own models instead of his biplane model ... -
Simple Flight Sim DOH!
I have found an error with the w3d model I exported from lightwave Can anyone suggest a good converter for 3d models? please Thanks -
Setting up a pre-flight
Hi I am trying to set up a preflight for our department. I have defined most of what I need, but I'm struggling on the images. We have a rule that... -
Ground movement in flight sim
Try the "Texture Scrolling" behavior in the Chrome Lib: http://membres.lycos.fr/karlsigiscar/shockwave3d/ -
Matt McSpirit #2
Re: Aeroflot Flight Web Service
I have another problem now too! It seems that the array being passed to me
from the second web service, sometimes doesnt pass a value for some positions
of the array.
For example, when assigning secondStruct.aircraftNumber =
aFlightDetailArray[1].bort;
If there isnt an aircraft number for that particular flight, the web service
obviously doesnt return a value for .bort, and i get the following message in
return:
Element BORT is undefined in a Java object of type class
coldfusion.runtime.StructBean referenced as....
And then the code that causes the error, pointing to the line i showed above.
Ive tried to cover for this error, by putting a cfif statement (not within
cfscript) that looked like this:
<cfif NOT IsDefined (aFlightDetailArray[1].bort)>
Set the variable to "unavailable"
<cfelse>
continue normally
</cfif>
But it doesnt seem to work.
Is there a way to check if an element is defined in this way? I know
IsDefined works on Coldfusion structures, but as im checking if the element is
defined in the array returned from the web service, it doesnt seem to work.
Any ideas?
Matt McSpirit Guest
-
Tom Jordahl #3
Re: Aeroflot Flight Web Service
Matt,
It sounds like the service is returning 'null' for these value, which in CF
translates in to a variable not being defined. IsDefined() is the right
check to use here. I am not sure why that isn't working for you.
As to the timezones, the web service engine that we use (Apache Axis)
converts dates to Calendar objects, which have the concept of timezone. The
default it to use the local timezone. I think you will have to convert the
date to the 'correct' timezone manually yourself (lots of CF date/time
functions), as the web service probably sends the time in UTC/GMT. Even if
it doesn't, Axis will normalize the timezone when it reads the XML.
Hope that help a bit.
--
Tom Jordahl
Macromedia Server Development
Tom Jordahl Guest



Reply With Quote

