Re: problems in creating a web service

Felipe Palma Dias <[email protected]>
Newsgroups gmane.text.xml.soap.user
Message-ID <[email protected]>
The DD example to the method servizio.c_Elenco():

<?xml version = '1.0' encoding = 'windows-1252'?>
<isd:service
   id="servizio_WS"
  
xmlns:isd="http://xml.apache.org/xml-soap/deployment">
   <isd:provider
      type="java"
      methods="c_Scelta"
      scope="Request">
      <isd:java class="servizio" static="true"/>
   </isd:provider>
  
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
</isd:service>

Change the code:

call.setTargetObjectURI("servizio_WS");
call.setMethodName("c_Scelta");

The method c_Scelta needs to be public.


 --- Francesco Dipalo <[email protected]> escreveu: 
> 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) {       
>  
=== message truncated === 

=====
------------------------------------------------------- 
Felipe F. Palma Dias 
http://geocities.yahoo.com.br/palmadias/


	
	
		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.