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 Hui Deng <hd...@yahoo.com> on 2002/05/15 08:17:09 UTC

deploy an object as Web Service (application scope)

Hi all,

Before my questions, here is what I'm trying to do:
   
   I'm writing a MobilityAxisServlet, it's basically
an AxisServlet with couple other components. These
components enable this servlet to accept mobile
agents. Upon the arrival of agent, the servlet deploys
the agent as Web Service, makes the service agent
provides available online. 
 To achieve it, I guess I need to do two things as I
dig through some old threads. First, is to deploy the
service upon the arrival of agent (add deploy desc to
in-memory engine configuration, but not to
server-config.wsdd as my case). Second,  put the agent
(actually an object) into somewhere (I�m still
struggling with it) at application scope. 
My question is how to do it in term of coding. I�m
newer to Axis, and spend some time on it, but may not
be enough to solve it. What I did so far doesn�t work.
I got confused, because there are several points to
deploy service, but I�m not getting there.

  I construct the deploy string serviceStr, then try
to use XMLStringProvider to dynamically deploy the
services whenever the agents arrive ( or I should use
AdminClient as better solution?):

String serviceStr = "<deployment
xmlns=\"http://xml.apache.org/axis/wsdd/\"" +
          "
xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">\n"
+
           "<service name=\"MyService\"
provider=\"java:RPC\">\n" +
              "<parameter name=\"className\"
value=\"samples.userguide.example3.MyService\"/>\n" +
              "<parameter name=\"methodName\"
value=\"*\"/>\n" +
           "</service>\n" +
        "</deployment>";
 try{
           XMLStringProvider xml = new
XMLStringProvider(serviceStr);
           xml.configureEngine(engine);
           System.out.println("reconfigure the
engine.");

        }catch(ConfigurationException ex){

        }

Since the service object (java object) is not
instantiate from class file, it�s already there, I
used the following code to deploy it:
Object agent = (Agent)e.getAgent();
        // put object in application scope session
         String serviceName =
agent.getClass().toString();
            // Remove the word "class":
         if(serviceName.indexOf("class") != -1)
               serviceName = serviceName.substring(6);
         System.out.println(serviceName);
         log.debug(serviceName);
        
engine.getApplicationSession().set(serviceName,
agent);

Am I correct? I need direction to explore Axis API to
get there.

Thanks,

-Hui Deng 


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com