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 Kathy Chan <ka...@ca.ibm.com> on 2007/04/23 23:27:47 UTC

Is there a way to programmatically update the classpath or change the class loader for AxisEngine?

Hi,

When I use Axis Admin to ask the AxisEngine to process a deploy.wsdd, is 
there a way I could programmatically update the classpath or change the 
class loader for the AxisEngine?  I need to do pass the classpath of the 
Axis servlet I am targetting to the AxisEngine I am creating because 
otherwise, when the AxisEngine process the deploy.wsdd containing type 
mapping, it could not load the beans that are refered to by the type 
mappings.

Regards,
Kathy Chan
 

----- Forwarded by Kathy Chan/Toronto/IBM on 04/23/2007 05:19 PM -----

Kathy Chan/Toronto/IBM
03/22/2007 02:16 PM

To
axis-user@ws.apache.org
cc

Subject
Re: Is there a way to programmatically get the content of 
server-config.wsdd?





Hi,

After some looking around, I was able to do what I need.  Here's what I 
was able to do in case others want to do something similarly.

Since I have a number of Web projects with different Axis servlet running 
on it,  I want to be able to send the Axis admin message to and get 
server-config.wsdd back from a particular one I specify, I was able to 
feed the existing server-config.wsdd  from the particular Axis servlet I 
am targetting to the AxisEngine I am creating programmatically (using the 
constructor on AxisEngine) so that subsequent deploying of deploy.wsdd 
would be to this new AxisEngine which effectively has the same 
configuration as the Axis servlet I'm targetting.  Then, I was able to get 
the resulting server-config.wsdd from this new AxisEngine and write it 
back out to the Axis servlet I am actually targetting. 

Regards,

Kathy Chan




Kathy Chan/Toronto/IBM@IBMCA 
03/21/2007 12:41 PM
Please respond to
axis-user@ws.apache.org


To
axis-user@ws.apache.org
cc

Subject
Re: Is there a way to programmatically get the content of 
server-config.wsdd?







Thanks for the info! 

I was able to use the following code snippet to get the server-config.wsdd 
for a new AxisEngine where deployFilename is the name of a deploy.wsdd 
file: 

          Admin admin = new Admin(); 
          AxisEngine engine = new AxisServer(); 
        engine.setShouldSaveConfig(true); 
        engine.init(); 
        MessageContext msgContext = new MessageContext(engine); 
          Document doc = XMLUtils.newDocument( new FileInputStream( 
deployFilename ) ); 
        Document result = admin.process(msgContext, 
doc.getDocumentElement()); 
        Document adminDoc = Admin.listConfig(engine); 
        // adminDoc now contains server-config.wsdd 

However, I need to point the Axis AdminClient to a specific URL that 
represent an Axis servlet running on a particular Web project.  I have 
been using the org.apache.axis.tools.ant.axis.AdminClientTask to point to 
an URL and deploy a deploy.wsdd file using the following snippet: 

import org.apache.axis.tools.ant.axis.AdminClientTask; 
  
AdminClientTask adminClient = new AdminClientTask(); 
adminClient.setUrl(url); // e.g. url = "
http://localhost:8080/myWebProject/services/AdminService" 
adminClient.setXmlFile( deployFilename ); // e.g. deployFilename = 
deploy.wsdd 
adminClient.execute(); 

I just need to get the resulting server-config.wsdd back programmatically. 


I tried looking at the defined API for AxisEngine and Admin to see if 
there's a way to specify the URL of the admin service for the Axis servlet 
I want to connect to but was not able to find it.  What is the proper way 
to get the server-config.wsdd for a specific Axis servlet that's running 
on a specific Web project? 

Regards,
Kathy Chan




"Davanum Srinivas" <da...@gmail.com> 
03/01/2007 06:46 PM 

Please respond to
axis-user@ws.apache.org


To
axis-user@ws.apache.org 
cc

Subject
Re: Is there a way to programmatically get the content of 
server-config.wsdd?








You can use the "org.apache.axis.utils.Admin" instead of the AdminClient.

See usages here:
http://www.google.com/search?hl=en&q=org.apache.axis.utils.Admin&btnG=Google+Search


-- dims

On 3/1/07, Kathy Chan <ka...@ca.ibm.com> wrote:
>
> Hi,
>
> I would like to find out if there is a way I could get the content of
> server-config.wsdd programmatically.
>
> I understand that server-config.wsdd is created when I call the Axis
> AdminClient with the Axis servlet URL and a deploy.wsdd file.  The
> server-config.wsdd file is generated into the publish directory of the
> server.  This present a problem because in Eclipse WTP, the server 
publish
> the content from the Eclipse workspace but the "live" publish directory 
the
> server uses may or may not be in the workspace (it could be in some
> temporary location or server specific location that the workspace 
content is
> copied to).  This causes a problem because the server-config.wsdd that
> contains information on what Web services are deployed could be lost 
when
> the server republishes from the workspace (since that file is not in the
> workspace but is in the "live" publish directory).   I need to find a 
way to
> persist the server-config.wsdd in the Eclipse workspace so that the
> information would not be lost in subsequent republish.
>
> One way I was able to workaround the problem is copying the
> server-config.wsdd file from the server's live publish directory back to 
the
> workspace but it requires the servers to implement an API to return the
> publish directory.  However, that means we need to ask all servers we 
could
> generate Axis Web service on to support it.  This is not scalable or 
easily
> achievable since that list of servers are growing constantly.
>
> So, I would like to find out if there's a call I could make (or a 
parameter
> I could specify in AdminClient) that would return the content of
> server-config.wsdd file programmatically rather then just expect to find 
it
> in the server's publish directory.  If this support is not there 
currently,
> could it be easily implemented in the next release?
>
> Regards,
>  Kathy Chan
>
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org