Need Help With Webservice invocation

I am trying to invoke the webservice with AirlineFlightSchedules method in Cold fusion
But I get this error

Here is my script FYI :

stAuth = structNew();
stAuth.username = “XXXXXXXXXXX”;
stAuth.password = “XXXXXXXXXXXXXXXXXX”;
stAuth.wsversion = 1;
ws = createObject(“webservice”, “”, stAuth);
stAirlineFlightSchedule = structNew();
stAirlineFlightSchedule.howMany = 60;
stAirlineFlightSchedule.flightno = “#form.vFlightNum#”;
aArrayOfAirlineFlightScheduleStruct = ws.AirlineFlightSchedules(stAirlineFlightSchedule);

vFlights = aArrayOfAirlineFlightScheduleStruct.getAirlineFlightScheduleResult().getFlights()

Is there anything that I am missing or doing wrong?

Please guide me on this

Thanks in advance

I’m not very familiar with Cold Fusion, but looking at the error I would guess that the Cold Fusion SOAP client is strict in its enforcement of the WSDL structs. If you look at the AirlineFlightSchedulesRequest object in the WSDL the minOccurs and maxOccurs are both set to 1.

Probably the easiest way to solve that problem is to just set all the fields that you are not including to an empty string. The server will then treat them the same as if they were not present.

Thanks I was able to invoke the web service now

vFlights = aArrayOfAirlineFlightScheduleStruct.getAirlineFlightScheduleResult().getFlights()

But I dont find the get method the getAirlineFlightScheduleResult() method I am using is not found
Can you suggest any method that I can use for getting the results from this


This is code for a Java SOAP client, but it should be fairly similar to CodeFusion I think. getAirlineFlightScheduleResult() returns an ArrayOfAilrineFlightScheduleStruct and the getData() method on that type returns a list of type AirlineFlightScheduleStruct:

            ArrayOfAirlineFlightScheduleStruct res = df.airlineFlightSchedules(req).getAirlineFlightSchedulesResult();
        res.getData().forEach(a -> {
            System.out.println(String.format("Flight: %s, Departs: %s, Arrives: %s", 

I installed ColdFusion and confirmed that you need to use getData. Looks like ColdFusion is using axis2 for the soap request, so you could generate the FlightXML2Stub using axis2 to see the data structures and methods available on each class. Here is what I did and confirmed that it worked.

flights = ws.AirlineFlightSchedules(stAirlineFlightSchedule).getAirlineFlightSchedulesResult().getData();
<cfloop from="1" to="#ArrayLen(flights)#" index="i">
  <cfset dtime = DateAdd("s",flights[i].departureTime,DateConvert("utc2Local", "January 1, 1970 00:00")) />
  <cfoutput>#flights[i].ident# will depart at #dtime#<br/></cfoutput>

Thanks a lot it works fine for me now