0

I am trying to write a code to consume a web service found at: http://www.webservicex.net/ws/WSDetails.aspx?CATID=12&WSID=64

I've used Axis2's WSDL2Java.bat tool and had two Java files generated:

  • GeoIPServiceStub.java
  • GeoIPServiceCallbackHandler.java

I've imported these, as well as the axis 'lib' folder into my project.

This is the code I'm using:

    GeoIPServiceStub stub = new GeoIPServiceStub();

    GetGeoIP geoIP = new GetGeoIP();

    geoIP.setIPAddress("X.X.X.X");
    GetGeoIPResponse reponse = stub.getGeoIP(geoIP);

When I try running it, it throws an InstantiationError.

Many thanks in advance!

LevEidel
  • 43
  • 1
  • 5

1 Answers1

0

you are trying to instantiate an abstract class or interface. that's why InstantiationError is thrown.

As per the docs, it is stated as follows

public class InstantiationError extends IncompatibleClassChangeError

Thrown when an application tries to use the Java new construct to instantiate an abstract class or an interface.Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.

Keerthivasan
  • 12,760
  • 2
  • 32
  • 53
  • Thanks! It makes sense. I think I'm not initializing "stub" the way I am supposed to. Any ideas? – LevEidel Dec 31 '13 at 15:23
  • You are welcome, Check this link - http://stackoverflow.com/questions/1665595/how-to-use-axis-wsdl2java-generated-files and read the links provided – Keerthivasan Dec 31 '13 at 17:58
  • Okay, it works.. sorta. Every once in a while I get _NullPointerException_ thrown at me. When I do a _printStackTrace()_ I get the following: **"Unable to locate a valid EngineConfigurationFactory"** – LevEidel Jan 02 '14 at 08:08
  • Please accept my answer. that's probably another question. but, i will help you. I did some search and found this [link](https://issues.apache.org/jira/browse/AXIS-2897). It seems to be an open bug in axis – Keerthivasan Jan 02 '14 at 11:56
  • That's the ticket. Thanks a lot! – LevEidel Jan 02 '14 at 16:09