You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Roland Carlsson <ro...@alfa-moving.se> on 2005/07/20 10:08:11 UTC

Dynamic stubs

Hi!
Is it possible with Axis to create stubs "on-the-fly"?

My motivation is that I have a (legacy) system that generate statistics 
that I can access through web-services. The number of web-services and 
their arguments changes quite often so it is quite inconvinient to have 
to rebuild the stubs and then rebuild my web-application and then deploy 
that.

Perhaps there is another way to solve this problem with a constanly 
changing set of webservices that need to be correctly reflected into an 
application? If so I'm very interested in learning about that.

Thank you very much
Roland Carlsson



Re: Dynamic stubs

Posted by Roland Carlsson <ro...@alfa-moving.se>.
Thanks!

It workes very well with the dynamic invocation of the webservices. I 
made a few alterations of the DynamicInvocation example (to be able to 
run it without the main-method) and it works like perfectly for our needs.

Regards
Roland

Tom Oinn skrev:

> Roland Carlsson wrote:
>
>> Hi!
>> Is it possible with Axis to create stubs "on-the-fly"?
>
>
> You could potentially do this if you're familiar with writing custom 
> classloaders - effectively you can use the WSDL2JAVA tool and then 
> dynamically load the byte code in the generated class files. I don't 
> think this is the best way to do this but it will work (the Triana 
> project in the UK did this to cope with web services in workflows for 
> example).
>
> The correct way to do this (in my opinion anyway) is to use the WSDL 
> documents describing the web services directly rather than generating 
> stub classes - it is entirely possible to invoke arbitrary services 
> with complex types etc without having to go through any compilation 
> stage at all, by the sounds of it your requirement is something like 
> 'discover all services, invoke service to gather stats, do analysis' - 
> the first part is up to you as is the analysis but you can do the 
> invocation on the fly.
>
> There is a very simple dynamic invocation example in the axis code, 
> the most obvious question you'll have from this example is 'what about 
> complex types?'. In this context a complex type is anything that you 
> would normally have to register a custom serializer for (this is the 
> main thing the stub classes will do for you). If you're not compiling 
> and loading classes on the fly you won't be able to access these types 
> through java classes but that shouldn't really be a problem - soap is 
> all about passing XML documents around so you should be able to 
> intercept the xml representation of the return value and use it 
> directly (this is what we do in our workflow engine when calling 
> complex services).
>
> Our rather more complex dynamic invocation system is visible at 
> http://cvs.sourceforge.net/viewcvs.py/taverna/taverna1.0/src/org/embl/ebi/escience/scuflworkers/wsdl/ 
> with the WSDLBasedProcessor responsible for creating and configuring 
> an axis call object from a WSDL document and the WSDLInvocationTask 
> responsible for using this object to call the service. Yes, this is a 
> lot of code for something that should be fairly simple, no, this is 
> not my fault :)
>
> HTH,
>
> Tom



Re: Dynamic stubs

Posted by Tom Oinn <tm...@ebi.ac.uk>.
Roland Carlsson wrote:
> Hi!
> Is it possible with Axis to create stubs "on-the-fly"?

You could potentially do this if you're familiar with writing custom 
classloaders - effectively you can use the WSDL2JAVA tool and then 
dynamically load the byte code in the generated class files. I don't 
think this is the best way to do this but it will work (the Triana 
project in the UK did this to cope with web services in workflows for 
example).

The correct way to do this (in my opinion anyway) is to use the WSDL 
documents describing the web services directly rather than generating 
stub classes - it is entirely possible to invoke arbitrary services with 
complex types etc without having to go through any compilation stage at 
all, by the sounds of it your requirement is something like 'discover 
all services, invoke service to gather stats, do analysis' - the first 
part is up to you as is the analysis but you can do the invocation on 
the fly.

There is a very simple dynamic invocation example in the axis code, the 
most obvious question you'll have from this example is 'what about 
complex types?'. In this context a complex type is anything that you 
would normally have to register a custom serializer for (this is the 
main thing the stub classes will do for you). If you're not compiling 
and loading classes on the fly you won't be able to access these types 
through java classes but that shouldn't really be a problem - soap is 
all about passing XML documents around so you should be able to 
intercept the xml representation of the return value and use it directly 
(this is what we do in our workflow engine when calling complex services).

Our rather more complex dynamic invocation system is visible at 
http://cvs.sourceforge.net/viewcvs.py/taverna/taverna1.0/src/org/embl/ebi/escience/scuflworkers/wsdl/ 
with the WSDLBasedProcessor responsible for creating and configuring an 
axis call object from a WSDL document and the WSDLInvocationTask 
responsible for using this object to call the service. Yes, this is a 
lot of code for something that should be fairly simple, no, this is not 
my fault :)

HTH,

Tom

Re: Dynamic stubs

Posted by An...@mro.com.
you might want to look at the Call api - which works without generating
stubs. Whenever you are into stubs you loose the "dynamism".
Anamitra


                                                                           
             Roland Carlsson                                               
             <roland@alfa-movi                                             
             ng.se>                                                     To 
                                       axis-user@ws.apache.org             
             07/20/2005 04:08                                           cc 
             AM                                                            
                                                                   Subject 
                                       Dynamic stubs                       
             Please respond to                                             
             axis-user@ws.apac                                             
                  he.org                                                   
                                                                           
                                                                           
                                                                           




Hi!
Is it possible with Axis to create stubs "on-the-fly"?

My motivation is that I have a (legacy) system that generate statistics
that I can access through web-services. The number of web-services and
their arguments changes quite often so it is quite inconvinient to have
to rebuild the stubs and then rebuild my web-application and then deploy
that.

Perhaps there is another way to solve this problem with a constanly
changing set of webservices that need to be correctly reflected into an
application? If so I'm very interested in learning about that.

Thank you very much
Roland Carlsson