Aeroflot Flight Web Service

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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 ...
    3. 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
    4. 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...
    5. Ground movement in flight sim
      Try the "Texture Scrolling" behavior in the Chrome Lib: http://membres.lycos.fr/karlsigiscar/shockwave3d/
  3. #2

    Default 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

  4. #3

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139