You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Anthony Ikeda <an...@proxima-tech.com.au> on 2001/06/28 11:17:07 UTC

ServiceManagerClient - Creating my own class

I have created my own class that should:

*    load a deployment descriptor file
*    construct a ServiceManagerClient and DeploymentDescriptor class
*    List all deployed services
*    If the service to be deployed does not exist, deploy it
*    Create a new entry for a particular service

Here is the code I use:

  public static void main(String[] args) {
        ServiceManagerClient smc = null;
        String[] list=null;

        try{
            smc = new ServiceManagerClient(new
            URL("http://127.0.0.1:8200/soap/servlet/rpcrouter"));
            list = smc.list();
        } catch(Exception e){
           System.out.println("Error connecting to the router: "+e);
           System.exit(1);
        }

        DeploymentDescriptor dd = new DeploymentDescriptor();

        URL descriptorXML = null;
        String xmlString="";

        if(list!=null&&list.length>0){
             for(int i=0;i<list.length;i++){
                 String service = list[i];
                 System.out.println(service);
              }
        } else {
           try{
               descriptorXML = new URL("file",
null,0,"W:/SOAPDev/DeploymentDescriptor.xml");
               FileReader fr = new FileReader(descriptorXML.getFile());
               LineNumberReader lnr = new LineNumberReader(fr);
               String tempString = "";
               while((tempString = lnr.readLine())!=null){
                    xmlString = xmlString.concat(tempString);
               }
           } catch (Exception e){
             System.out.println("Error starting up: "+e);
             System.exit(1);
           }

           StringReader strdr = new StringReader(xmlString);
           dd.fromXML(strdr);

   try{
     smc.deploy(dd);
   } catch (SOAPException se){
     System.out.println("Error deploying: "+se);
     System.exit(1);
   }

The descriptor file loads up okay and it gets to the smc.deploy() method and
I get the error:

Ouch, the call failed:
  Fault Code   = SOAP-ENV:Server
  Fault String = Exception from service object: null

Are there any extra steps to make before I deploy the descriptor? Where can
I get more info on how to embed this functionality?

Cheers,
Anthony Ikeda