I will try to follow your suggestion but I don't know if I can do it because
I never do this thing
----- Original Message ----- 
From: "Scott Nichol" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 20, 2004 8:13 PM
Subject: Re: problems in creating a web service


In this case, it would mean to create classes with just program logic and no
user I/O from the classes with user I/O.  For example, the servizio method
c_Elenco currently writes a list of files to System.out.  The program logic
here would be getting the list of files.  The user I/O is printing them to
System.out.  A class used for a SOAP service might have a method that
returned the list of files in an array.  There might then be a class used by
the client application that would call this SOAP method to get the list,
then print the file names to System.out.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Francesco Dipalo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 20, 2004 1:55 PM
Subject: Re: problems in creating a web service


> What does it mean "to factor a class"?
> ----- Original Message ----- 
> From: "Scott Nichol" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, October 20, 2004 7:48 PM
> Subject: Re: problems in creating a web service
>
>
> It looks to me like servizio methods prompt the user for input and write
> stuff to System.out.  SOAP does not interact with a user.
>
> The composizione also seems to directly or indirectly interact with
> System.in and System.out.  Besides that, it has no methods, just a
> constructor.
>
> To expose some of your logic through SOAP, you need to factor out classes
> that just do computations, file and database I/O, etc.  The code that
> interacts with a human needs to be in the client application.
>
> Scott Nichol
>
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message ----- 
> From: "Francesco Dipalo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, October 20, 2004 1:00 PM
> Subject: Re: problems in creating a web service
>
>
> > For example, if I have this java class
> >
> > package javasoap.book.ch4;
> > public class MethodCounter {
> >    int _counter;
> >    public MethodCounter() {
> >       _counter = 0;
> >    }
> >    public int getCount() {
> >       return _counter;
> >    }
> >  }
> > I create a deployment descriptor file and an application like this to
> > execute the getCount method:
> >
> > package javasoap.book.ch4;
> > import java.net.*;
> > import org.apache.soap.*;
> > import org.apache.soap.rpc.*;
> > public class GetCountApp {
> >    public static void main(String[] args)
> >       throws Exception {
> >
> >       URL url =
> >         new URL(
> >           "http://localhost:8080/soap/servlet/rpcrouter";);
> >
> >       Call call = new Call();
> >       call.setTargetObjectURI("urn:CallCounterService");
> >       call.setMethodName("getCount");
> >       try {
> >          Response resp = call.invoke(url, "");
> >          Parameter ret = resp.getReturnValue();
> >          Object value = ret.getValue();
> >          System.out.println("Result is " + value);
> >       }
> >       catch (SOAPException e) {
> >          System.err.println("Caught SOAPException (" +
> >                          e.getFaultCode() + "): " +
> >                          e.getMessage());
> >       }
> >    }
> > }
> >
> > Do you understand now what my purpose is? In my case I want to execute
> > servizio and composizione methods.
> > ----- Original Message ----- 
> > From: "Scott Nichol" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 20, 2004 4:18 PM
> > Subject: Re: problems in creating a web service
> >
> >
> > What exactly do you mean by "transform this software in a web service"?
> > What classes and/or methods to you want to access via SOAP?
> >
> > Scott Nichol
> >
> > Do not send e-mail directly to this e-mail address,
> > because it is filtered to accept only mail from
> > specific mail lists.
> > ----- Original Message ----- 
> > From: "Francesco Dipalo" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 20, 2004 2:41 AM
> > Subject: problems in creating a web service
> >
> >
> > I have this software:
> >
> >
> > THE APPLICATION_CONTROLLER CLASS
> > import java.io.*;
> > import java.util.*;
> > public class application_controller {
> >  public static void main(String [] args) {
> >        servizio s = new servizio();
> >        composizione c = new composizione(
> >               s.c_Nomefile1, s.c_Nomefile2, s.c_Nomefile );
> >  }
> > }
> >
> >
> > THE SERVIZIO CLASS
> > import java.io.*;
> > import java.util.*;
> > public class servizio {
> >  public static String c_Nomefile;
> >  public static String c_Nomefile1;
> >  public static String c_Nomefile2;
> >  public servizio() {
> >        c_Elenco();
> >        c_Scelta();
> >  }
> >  static private void c_Elenco() {
> >   System.out.println("ELENCO SERVIZI:");
> >   String [] lista = new File(".").list();        //crea lista
> >   for(int cx=0; cx<lista.length; cx++)
> >     if ( new File(lista[cx]).isFile() )          //verifica se S file
> >        if ( lista[cx].toLowerCase().lastIndexOf(".owl") >= 0)     //e
con
> > estensione .owl
> >               System.out.print((" þ "+lista[cx]+"
> > ").substring(0,20));
> >  }
> >  static private String input(String prompt) {
> >    String instr = "";
> >    try {
> >        BufferedReader inp = new BufferedReader(new
> > InputStreamReader(System.in));
> >        do {
> >               System.out.print(prompt);
> >        } while ((instr = inp.readLine()).length() == 0);
> >      } catch(Exception e){};
> >    if (instr.lastIndexOf(".") < 0) instr += ".owl";
> >    return instr;
> >  }
> >  static public void c_Scelta() {
> >     c_Nomefile1 = input("\nServizio principale : ");
> >     c_Nomefile2 = input("Servizio da comporre: ");
> >     // crea nome file composto
> >     c_Nomefile = c_Nomefile1.substring(0,c_Nomefile1.lastIndexOf(".")) +
> > c_Nomefile2;
> >  }
> > }
> >
> >
> > THE COMPOSIZIONE CLASS
> > import java.io.*;
> > import java.util.*;
> > public class composizione {
> >  public static int c_Comp;                // esito della composizione
> >  public composizione (String file_1, String file_2, String
file_composto)
> {
> >        output out = new output();
> >        if ( (c_Comp = new metodi_xml(file_2).c_ProceduraTag(file_1)) ==
0)
> {
> >               out.c_EliminaFile();
> >               out.c_ScriviMessaggio();
> >        } else {
> >               System.out.println("\nFILE COMPOSTO:\n");
> >               out.c_StampaFile();
> >               out.c_SpostaFile(file_1, file_2, file_composto);
> >        }
> >  }
> > }
> >
> >
> > THE METODI_XML CLASS
> > import java.io.*;
> > import java.util.*;
> > public class metodi_xml {
> >  public static String c_Tabella;
> >  final private static String fileTMP = "tmp.owl";
> >  final private static xml_pars owl = new xml_pars();    //classe parsing
> > .XML
> >  private static String tempor;
> >  private static String linea;
> >  private static boolean corretto;
> >  public metodi_xml (String file) {
> >        System.out.print("Apro il file "+file+" ... ");
> >        if (! (corretto = owl.load_parsing(file)) )
> >               System.out.println("Errore!");
> >        else c_CompilaTabella(file);
> >  }
> >  public static void c_CompilaTabella(String file) {     // crea tabella
> >        System.out.println("Ok!\nCompilo la tabella...");
> >        owl.tag(2);          //salta header (tag <?> e tag Ontology)
> >        c_Tabella = tempor = "";
> >        while(true) {
> >               //String tag = owl.ctags();
> >               String tag = owl.tags();
> >               if (owl.nido < 0) break;
> >               tempor += tag; c_AnalisiTag(tag);
> >               if (linea.length() > 1) c_Tabella += linea + "\n";
> >        }
> >  }
> >  public static int c_AnalisiTag(String tag) {           // ritorna tipo
> tag
> > e linea
> >        linea = ".";
> >        if (owl.si_tag(tag,"<owls:") > 0) {
> >               linea = owl.search_true(tag, "owls:Class ", "C") +
> >                       owl.search_true(tag, "owls:ObjectProperty ", "P")
+
> >                       //owl.search_true(tag, "owls:Ontology ", "O") +
> >                       linea;
> >               if (linea.length() == 1) {
> >                      System.out.println("Tag sconosciuto: " + tag);
> >                      corretto = false; };
> >               linea += owl.search_tag(tag, "name=");    //"owls:name"
> >        };
> >        return linea.charAt(0);
> >  }
> >  public static int c_ProceduraTag(String file) {        // esegue
utility
> >        int comp=0; String temp = "", tag = "";
> >        System.out.print("Apro il file "+file+" ... ");
> >        if (! owl.load_parsing(file) ) {
> >               System.out.println("Errore!");
> >               corretto = false; };
> >        if (corretto) {
> >               System.out.println("Ok!\nAvvio utility...");
> >               owl.tag(2);   //salta header (tag <?> e tag Ontology)
> >               do {
> >                      tag = owl.tags();    //o tag = owl.tag(0);
> >                      int tipo = c_AnalisiTag(tag);
> >                      if (linea.length() > 1) {
> >                             if (c_Tabella.indexOf(linea) < 0) {
> >                                    //temp += owl.ctag_root(owl.xml_id);
> >                                    temp += owl.tag_root(owl.xml_id);
> >                             } else {
> >                                    if (tipo == 'C') comp = 1;  //...
> >                             }
> >                      }
> >               } while (owl.nido >= 0);
> >        };
> >        if (!corretto) { System.out.println("Utility interrotta per
> > errori."); comp = 0; };
> > //     if (temp.length() > 0) {           //aggiunge intestazione padre
> >               owl.reset(); tempor = owl.tags() + owl.tags() +
> >                      tempor + temp + tag; //};   //temp + tempor + tag;
> //};
> >        owl.save_pars(fileTMP, tempor);    //crea file temporaneo
> >        return comp;
> >  }
> > }
> >
> >
> > THE OUTPUT CLASS
> > import java.io.*;
> > import java.util.*;
> > public class output {
> >  final private static String fileTMP = "tmp.owl";
> >  final private static String cartellaServizi = "servizi";
> >  final private static xml_pars owl = new xml_pars(2,8); //classe parsing
> > .XML
> >  private static void waitkey() {
> >   try {
> >        System.out.print("\nPremere INVIO per proseguire...");
> >        System.in.read(); System.out.println();
> >     } catch(Exception e) {}
> >  }
> >  public static void c_SpostaFile(String file_1, String file_2, String
> > file_composto) {
> >        owl.newdir(cartellaServizi);       //se non c'S crea la cartella
> >        //new File(cartellaServizi).mkdirs(); new
> File(fileTMP).renameTo(new
> > File(cartellaServizi + "/" + file_composto));
> >        if (owl.load_parsing(fileTMP)) {
> >               owl.save_parsing(cartellaServizi + "/" + file_composto);
> > c_EliminaFile();
> >               owl.load_parsing(file_1); owl.save_parsing(cartellaServizi
+
> > "/" + file_1);
> >               owl.load_parsing(file_2); owl.save_parsing(cartellaServizi
+
> > "/" + file_2);
> >        }
> >  }
> >  public static void c_StampaFile() {
> >    int cx=0;
> >    if (owl.load_parsing(fileTMP))
> >        do {   System.out.print(owl.ctags()); if ( ((++cx)&15) == 0)
> > waitkey();
> >        } while (owl.nido >= 0 || cx<3);
> >  }
> >  public static void c_EliminaFile() {
> >        owl.delfile(fileTMP);       //new File(fileTMP).delete();
> >  }
> >  public static void c_ScriviMessaggio() {
> >        System.out.println("\nI due servizi non sono tra loro
> componibili.");
> >        waitkey();
> >  }
> > }
> >
> > How can I create the .dd file and the application file to transform this
> > software in a web service? Thanks for the help and excuse for the lenght
> of
> > the message
> >
> >
> >  --
> >  Email.it, the professional e-mail, gratis per te: http://www.email.it/f
> >
> >  Sponsor:
> >  La foto che hai sempre vicino a te... Stampala su un nostro gadget!
> > * Stelle & Strisce stampa quello che vuoi TU .... dove Vuoi Tu!!
> > *
> >  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid!16&d -10
> >
> >
> >
> >
> >  --
> >  Email.it, the professional e-mail, gratis per te: http://www.email.it/f
> >
> >  Sponsor:
> >  Il Cinema a casa Tua!: film e dvd a meno di 10 Euro! Clicca e scopri
> tutti i titoli
> >  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2755&d=20-10
> >
>
>
>
>
>  --
>  Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
>  Sponsor:
>  Vuoi ricevere gratuitamente, ogni giovedì, manuali e guide per il tuo PC?
Aggiornati gratis con Manuali.net! Clicca qui
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2733&d=20-10
>


Reply via email to