Hello,

            I am using apache soap server for developing soap/corba
interface. I am trying some examples on my own.

           I tried to write  simple server/client example. 

        Please find the server / client / deployemnt descriptor.file
lisiting below

        package samples.TestExample1;

import java.util.*;

public class Hello
{
  public static String sayHello(String name) throws Exception
  {
    String ret;
    System.out.println("Hello.sayHello> starting server");
    //ret = "Trying as sample" + "Hello" + name + "!!";
    return ("Trying as sample " + " - Hello - " + name + "!!");
  }
}



package samples.TestExample1;

import java.io.*;
import java.util.*; 
import java.net.*;

import org.apache.soap.*;
import org.apache.soap.rpc.*;
 
public class HelloClient { 
  public static void main(String[] args) throws Exception {

    System.out.println("HelloClient.main > starting client");
    if (args.length != 1) 
    {
      System.err.println ("Usage: java " + HelloClient.class.getName () + "
SOAP-router-URL");
      System.exit (1);
    }

    // Process the arguments.
    URL ur1 = new URL (args[0]);

    //URL url = new URL("http://localhost:8086/soap/servlet/rpcrouter";);

    // Construimos la llamada.
    Call call = new Call();
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    call.setTargetObjectURI("urn:Hello");
    call.setMethodName("sayHello");

    // Vector de parámetros.
    Vector params = new Vector();
    params.addElement(new Parameter("parameterMessage", String.class,
"Pepe", null));
    call.setParams(params);

    // Hacemos la llamada.
    Response resp;

    try {
      resp = call.invoke(ur1, "");
    } catch (SOAPException e) {
      System.err.println("Caught SOAPException"); 
      System.err.println(" Fault Code: " + e.getFaultCode()); 
      System.err.println(" Fault Message: " + e.getMessage()); 
      return; 
    } 

    // Comprobamos la respuesta. 
    if (!resp.generatedFault()) { 
      Parameter ret = resp.getReturnValue(); 
      Object value = ret.getValue(); 

      System.out.println("SAY: " + ret.getValue()); 
    } else { 
      Fault fault = resp.getFault(); 

      System.err.println("Generated fault: "); 
      System.err.println(" Fault Code: " + fault.getFaultCode()); 
      System.err.println(" Fault String: " + fault.getFaultString()); 
    } 
  } 
}


<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment";
id="urn:Hello">
        <isd:provider type="java" scope="Application" methods="sayHello">
                <isd:java class="samples.TestExample1.Hello" />
        </isd:provider>
        
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListene
r>
</isd:service>


I run the sample and it runs , but if I change somethings on server and
rerun it runs with the old result and the changes in server side are not
refelected, please tell me why is this.

ravi.n

Reply via email to