Make sure (when you deploy your service with Admin Deploy tool) that the name is 
urn:Hello.

Csilla

amy <[EMAIL PROTECTED]> írta:

> hi,
>     But after I deployed my client program,  I ran it with"java hello.Client 
>amy".And there is an message:
> Generated fault:
>   Fault Code   = SOAP-ENV:Server.BadTargetObjectURI
>   Fault String = Unable to resolve target object: hello.HelloServer
> 
> I don't know how to solve it. So I paste my program as followed.
> 
> ///////////////////////////////////////
> HelloServer.java
> 
> package hello;
> public class HelloServer
> {
>    public String sayHelloTo(String name)
>    {
>       System.out.println("sayHelloTo(String name)");
>       return "Hello " + name + ", How are you doing?";
>    }
> }
> //////////////////////////////////////
> Client.java
> 
> 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/apache-soap/servlet/rpcrouter");
>             name = args[0];
>          }
> 
>          // Build the call.
>          Call call = new 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 my classpath is 
C:\xerces-1_4_3\xerces.jar;C:\soap-2_2\lib\soap.jar;C:\soap-2_2\lib\MAIL.jar;C:\soap-2_2\lib\activation.jar;C:\s
oap-2_2\;C:\soap-2_2\lib\bsf.jar;C:\soap-2_2\lib\js.jar;C:\jdk1.3\lib\tools.jar;C:\jdk1.3\lib\dt.jar;
> 
> 
> 
> This problem has puzzled me for several weeks.
> Please help me as possible as u can.
> 
> thank u very much.
>       amy
> 
> 


Reply via email to