I'm writing a simple HelloWorld server/client pair modifiying the code (in trivial 
ways) 
I got from www.skyserver.org. 

I have two classes 
c:\ApacheGroup\Soap-2_2\samples\local\SoapHelloServer.class
c:\ApacheGroup\Soap-2_2\samples\local\SoapHelloClient.class

everything compiles fine with Kawa pro and I deploy the service (urn:SoapHelloServer) 
OK
using the
Apache Admin tool and the entries match those in the screenshot on www.skyserver.org

typing java SoapHelloClient gives the following fault

Unable to resolve target object: SoapHelloServer


Set up and Background
-----------------------
Running  Apache Soap 2_2
 xerces.jar from Xerces 1.4.3 (I found Apache's samples won't run with xerces 2.0 and I
have also tried 1.2.3)
Windows NT

Yes  my  system classpath does include c:\ApacheGroup\Soap-2_2\samples\local
the script I am using is

java -cp
c:\JarFiles\xerces.jar;.;c:\JavaZipFiles\classes12.zip;c:\JarFiles\mail.jar;c:\JarFiles\activation.jar;\c:\JarFiles\bsf.jar;c:\JarFiles\js.jar;c:\JarFiles\soap.jar;c:\ApacheGroup\soap-2_2;c:\ApacheGroup\soap-2_2\samples\local;c:\ApacheGroup\soap-2_2\SoapHelloServer%CLASSPATH%
SoapHelloClient

(classes12.zip holds  oracle jdbc drivers)


The  client code is

import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.apache.soap.encoding.soapenc.*;

public class SoapHelloClient  
{
  public static void main(String[] args)  
    {
      String client="Alex";
      String host = "tvldpc003.ddns.asa-ehv.ce.philips.com:";
      String port = "8080";
      String protocol = "http://";;
      String directory = "/soap/servlet/rpcrouter";
      URL theURL = null;
      
      try   {theURL= new URL(protocol + host + port + directory);}
      catch (MalformedURLException mue)  { }
      System.out.println(theURL);


      Call helloCall= new Call();
      helloCall.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
      helloCall.setTargetObjectURI("urn:SoapHelloServer");
      helloCall.setMethodName("getMessage");
      
      Vector params = new Vector();
      Parameter p = new Parameter("clientName",String.class,(Object)client,null);
      params.addElement(p);   
       helloCall.setParams(params);
       
       try 
       {   
          Response resp = helloCall.invoke(theURL,"");
          if ( resp.generatedFault()) 
            {  
              System.err.println("There was a fault:" );
              String s = resp.getFault().toString();
              System.out.println(s);
                          System.out.println("Response was");
              System.out.println(resp.toString());
              Parameter pr = resp.getReturnValue();
  
                  System.out.println(p.getValue());
            
            }
           else 
            { Parameter pr = resp.getReturnValue();
                  System.out.println(p.getValue());
            }
       }
      catch (SOAPException e) 
        {
          System.err.println("There was an exception");
          System.err.println(e.getFaultCode()+"\n") ;
          System.err.println(e.getMessage()+"\n");   
        }
            
      
    }

}


The server code is


public class SoapHelloServer  
{
public String getMessage(String clientName) 
  {
  
  String response = "Hello to " + clientName + " From the soap Hello server";
//  System.out.println("Response was: " + response);
  return response;
  }

}















__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Reply via email to