Web Service Request

I have consume your web service and trying to return a method that will display all airlines. however its requesting for a parameter in the method ? Can you advice what the parameter is ? and or how to retrieve this information via soap web service.

The AllAirlines function does not take any arguments, but you might still need to pass an argument array definition to the SOAP framework you are using, depending on the language.

Can you provide an example of the code you are using to invoke it?

Here’s the web method below -

@WebMethod(operationName = “allAirlines”)
public AllAirlinesResults allAirlines(com.flightaware.flightxml.soap.flightxml2.AllAirlinesRequest parameters) {
// Note that the injected javax.xml.ws.Service reference as well as port objects are not thread safe.
// If the calling of port operations may lead to race condition some synchronization is required.
com.flightaware.flightxml.soap.flightxml2.FlightXML2Soap port = service_1.getFlightXML2Soap();
return port.allAirlines(parameters);
}

So you are not using Apache Axis for SOAP access in Java? Or is this actually using Axis?

The way your binding function is defined requires that an “AllAirlinesRequest” structure be passed to the function, which I suspect is a structure with no members.

What method did you use to auto-generate those bindings from the WSDL? There may be an option during auto-generation to allow it to declare functions with void arguments when appropriate.

Am currently using netbeans with jaxb for the binding.

Have passed the “AllAirlinesRequest” but Keep getting t
&&&&&&&&&&&&&&&&&&&&&&&&&&&
Method parameter(s)

Type Value
com.flightaware.flightxml.soap.flightxml2.AllAirlinesRequest
AllAirlinesRequest
WS00041: Service invocation threw an exception with message : null; Refer to the server log for more details
Exceptions details : java.lang.reflect.InvocationTargetException

Hi there!

The following code prints enroute aircraft and all airlines. You need to replace “user” and “key” with your own credentials. We will provide more details in the documentation page on how to write a client in NetBeans in the following days. Hope this helps:



///////////////////////////JAX_WS CLIENT NETBEANS/////////////////////////////////
package myflightxml;

import java.util.List;
import com.flightaware.flightxml.soap.flightxml2.*;
import java.net.Authenticator;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

public class MyFlightXML {

    private static final String WSDL_URL = "https://flightxml.flightaware.com/soap/FlightXML2/wsdl";

    public static void main(String] args) {
        URL wsdl_url = null;
        try {
            wsdl_url = new URL(WSDL_URL);
        } catch (MalformedURLException ex) {
            Logger.getLogger(MyFlightXML.class.getName()).log(Level.SEVERE, null, ex);
        }

        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication("user", "key".toCharArray());
            }
        });

        FlightXML2 locator = new FlightXML2(wsdl_url);
        FlightXML2Soap df = locator.getFlightXML2Soap();

        // Get the list of enroute aircraft.
        System.out.println("
---------- PRINT ENROUTE AIRCRAFT ----------
");
        EnrouteRequest req = new EnrouteRequest();
        req.setHowMany(10);
        req.setAirport("KAUS");
        req.setFilter("");
        req.setOffset(0);
        EnrouteStruct r = (df.enroute(req)).getEnrouteResult();
        for (EnrouteFlightStruct e : r.getEnroute()) {
            System.out.println(e.getIdent());
        }

        //show all airlines
        System.out.println("
---------- PRINT ALL AIRLINES ----------
");
        AllAirlinesRequest all_airlines_req = new AllAirlinesRequest();
        AllAirlinesResults all_airlines_result = df.allAirlines(all_airlines_req);
        ArrayOfString array = all_airlines_result.getAllAirlinesResult();
        List<String> list_all_airlines = array.getData();
        //walk the list
        for (String airline : list_all_airlines) {
            System.out.println(airline);
        }
    }
}

////////////////////////////// THE END /////////////////////////////////////////