Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

exposing an interface

 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i expose an interface as a web service. I get InstantiationException when I try to do this. Do I need to specify my implementation class also in the deploy.wsdd ??? I am using axis.
Regards
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shankar vembu:
how do i expose an interface as a web service. I get InstantiationException when I try to do this. Do I need to specify my implementation class also in the deploy.wsdd ??? I am using axis.
Regards

Hi,
I'm not sure to fully understand what you are trying to do here,.....but is it really possible ??
I mean, if you expose an interface, how can the WS implementation deal with it.??
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jean-Louis Marechaux:

Hi,
I'm not sure to fully understand what you are trying to do here,.....but is it really possible ??
I mean, if you expose an interface, how can the WS implementation deal with it.??

ok let me be clear. i have a running web-app where I have an interface that exposes some apis alongwith the implementation. Now I have to expose these APIs as a web-service. So I gotto expose my interface as a service, and when someone calls the APIs in this interface, the implementation will be invoked. Is this not possible ?? Do I have to expose my actual class(the implementation) instead of the interface itself as the service ??
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you expose the interface, I don't see how the Axis engine could be able to find the appropriate concrete class you really want to call.
But maybe I'm wong and there is a workaround to solve your problem
And what's the point anyway ??
Why don't you want to publish a concrete class which implements your interface ?? You'll be able to expose the api's of your interface, but through a concrete class.
Did I miss something in your needs ??
[ November 21, 2003: Message edited by: Jean-Louis Marechaux ]
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jean-Louis Marechaux:
If you expose the interface, I don't see how the Axis engine could be able to find the appropriate concrete class you really want to call.
But maybe I'm wong and there is a workaround to solve your problem
And what's the point anyway ??
Why don't you want to publish a concrete class which implements your interface ?? You'll be able to expose the api's of your interface, but through a concrete class.
Did I miss something in your needs ??
[ November 21, 2003: Message edited by: Jean-Louis Marechaux ]

ya, ur right. i better expose my class directly. i was always thinking in terms of my interface to be exposed. Just like the JDBC stuff where you are exposed to the interfaces and then you have these drivers implement them which you use by setting them in your classpath !!! But i dont see any way to tell axis, look here is my interface and this is it's implementation. so if someone calls ur API, pls check out the implementation!!!. I am ok with exposing my implementation directly.
regards.
 
Matt R. Hansen
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the client side, they can reference the concrete class by just typing:
Interface intrfce = (ConcreteClass)getConcreteClass();
if ConcreteClass implements Interface. This should work the same as what you were planning on.
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Matt R. Hansen:
On the client side, they can reference the concrete class by just typing:
Interface intrfce = (ConcreteClass)getConcreteClass();
if ConcreteClass implements Interface. This should work the same as what you were planning on.

getConcreteClass() ??? What does this method do ??
shankar
 
Matt R. Hansen
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, I should have specified. On the client side, when you receive the stub, you will do a lookup(), then a narrow(). This will return the concrete class you are expecting. Then the client can instantiate this concrete class as a type of the interface that you would like them to use.
Interface = the interface you would like to use.
ConcreteClass = the class you will need to pass to the client.
getConcreteClass() = (ConcreteClass)lookup().narrow().
This way, all of the method calls can be enforced by the interface, but you will just be passing another object that implements this interface.
I hope this isn't too cryptic.
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Matt R. Hansen:
I'm sorry, I should have specified. On the client side, when you receive the stub, you will do a lookup(), then a narrow(). This will return the concrete class you are expecting. Then the client can instantiate this concrete class as a type of the interface that you would like them to use.
Interface = the interface you would like to use.
ConcreteClass = the class you will need to pass to the client.
getConcreteClass() = (ConcreteClass)lookup().narrow().
This way, all of the method calls can be enforced by the interface, but you will just be passing another object that implements this interface.
I hope this isn't too cryptic.

thanx matt, i never knew this is possible. will check this out.
regards.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt, I have to ask -- what on EARTH are you referring to? That's just not the way that the JAX-RPC standard works (which is what you should use when programming with Axis, or any other Java Web Services API). What programming model are you using?
Kyle
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Matt R. Hansen:

Interface = the interface you would like to use.
ConcreteClass = the class you will need to pass to the client.
getConcreteClass() = (ConcreteClass)lookup().narrow().
I hope this isn't too cryptic.

This is far to cryptic for me.
Where is the narrow() method from ??
What kind of language is it ?
 
Your mind is under my control .... your will is now mine .... read this tiny ad
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!