Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis2 Interface Reference Variable Instantiationexception

Lee Miller
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone.

Web Services newbie question; seems so basic, but I can't find a similar thread...

We are using Axis2 to expose existing java code as web services. We are using the WSDL created automatically by the web app.

We are having a problem calling any method which exposes a parameter which contains objects with interface reference variables. eg.

- PostCodeConcrete implements PostCodeInterface
- Address Object contains a member variable of PostCodeInterface declared as PostCodeInterface p = new PostCodeConcrete();
- Another class exposes a method whose signature contains Address; eg. getPersonFromAddress( Address a ) on which the WSDL is based.

The client call to the webservice works fine from a JUnit test client. But when I try to test from a client I get an "java.lang.Instantiationexception". The code works from when I remove the interface reference variables, but as our code is existing, I would rather not re-write the entire system.

I ran the soapmonitor applet and the difference in the soap message is that the java client passes in a concrete type attribute for the parameter, so even though an interface is passed the SOAP message is telling Axis2 what concrete class to instantiate. does not pass in a type parameter, and I guess Axis2 is trying to instantiate an interface, hence the exception.

We would like to implement webservices to expose our java code to our code, but this is causing us a headache. As the major benefit of web services is platform interoperability, I am sure that the solution must be really simple.

Thanks in advance for any help.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic