hi,I am green on soap and need ur help.

My platform:
Tomcat 3.2.1
Apache soap 2.2
JDK 1.3.1
Win2000
 
I wrote a simple service as followed:
package hello;
public class HelloServer 
{
   public String sayHelloTo(String name)
   {
      System.out.println("sayHelloTo(String name)");
      return "Hello " + name + ", How are you doing?";       
   }    
}

The client code are showed below:

package hello;

import java.net.URL;
import java.util.Vector;            
import org.apache.soap.SOAPException;
import org.apache.soap.Constants;
import org.apache.soap.Fault;
import org.apache.soap.rpc.Call;
import org.apache.soap.rpc.Parameter;
import org.apache.soap.rpc.Response;
                             
public class Client
{
   public static void main(String[] args) throws Exception 
   {      
      if(args.length == 0)
      {
         System.err.println("Usage: java hello.Client [SOAP-router-URL] ");
         System.exit (1);
      }

      try
      {
         URL url = null;
         String name = null;              
         if(args.length == 2)
         {
            url = new URL(args[0]);
            name = args[1];
         }
         else
         {
            url = new URL("http://localhost:8080/soap/servlet/rpcrouter";);         
            name = args[0];
         }

         // Build the call.
         org.apache.soap.rpc.Call call = new org.apache.soap.rpc.Call();
         call.setTargetObjectURI("urn:Hello");
         call.setMethodName("sayHelloTo");
         call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);         
         Vector params = new Vector();         
         params.addElement(new Parameter("name", String.class, name, null));
         call.setParams(params);

         // Invoke the call.
         Response resp = null;         
         try
         {
            resp = call.invoke(url, "");
         }
         catch( SOAPException e )
         {
            System.err.println("Caught SOAPException (" + e.getFaultCode() + "): " + 
e.getMessage());
            System.exit(-1);
         }
   
         // Check the response.
         if( !resp.generatedFault() )
         {
            Parameter ret = resp.getReturnValue();
            Object value = ret.getValue();            
            System.out.println(value);
         }
         else
         {
            Fault fault = resp.getFault();            
            System.err.println("Generated fault: ");
            System.out.println ("  Fault Code   = " + fault.getFaultCode());  
            System.out.println ("  Fault String = " + fault.getFaultString());
         }
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }
   }   
}

And I deployed my service on apache soap.Here is my problem when I ran it:
E:\>java hello.Client me
Generated fault:
  Fault Code   = SOAP-ENV:Server
  Fault String = Exception while handling service request: hello.HelloServer.say
HelloTo(java.lang.String) -- no signature match

I checked it my code and service,and they were all right.I am confused about this 
problem.
Any help will grateful!

Sincerely

����������������������������amy
����������������������������[EMAIL PROTECTED]
����������������������������������2002-05-14


Reply via email to