Search code examples
javasoapwsdl

Strange response from a SOAP Client for a given WSDL in JAVA


Ok so i have to make a SOAP Client for a given WSDL in JAVA as the title says. Now i build it with NetBeans and the issue is that when i run it and put in the IP that i want i get the following response "net.webservicex.GeoIP@564809be"

I tested the WSDL at their site and for the same IP i get the following

<GeoIP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.webservicex.net/">
<ReturnCode>1</ReturnCode>
<IP>178.128.33.188</IP>
<ReturnCodeDetails>Success</ReturnCodeDetails>
<CountryName>Greece</CountryName>
<CountryCode>GRC</CountryCode>
</GeoIP>

Any ideas?? While i have to "decode" the message in order to be printed out normally? THanks in advance

Here's the code of the client

public static void main(String[] args) {
    try {
        System.out.println("Enter the IP Adress");
        InputStreamReader converter = new InputStreamReader(System.in);
        BufferedReader in = new BufferedReader(converter);
        String ipad = in.readLine();
        System.out.println(getGeoIP(ipad));

    } catch (IOException ex) {
        Logger.getLogger(Geoipad.class.getName()).log(Level.SEVERE, null, ex);
    }
}

private static GeoIP getGeoIP(java.lang.String ipAddress) {
    net.webservicex.GeoIPService service = new net.webservicex.GeoIPService();
    net.webservicex.GeoIPServiceSoap port = service.getGeoIPServiceSoap();
    return port.getGeoIP(ipAddress);

Solution

  • net.webservicex.GeoIP@564809be
    It seems you are printing the object's reference (the net.webservicex.GeoIP has not overriden toString). Don't they have some String getIP() to get the IP?