FileDocCategorySizeDatePackage
SampleClient.javaAPI DocExample1210Tue Jan 15 11:29:56 GMT 2002javasoap.book.ch7

SampleClient

public class SampleClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

      
      URL url = 
        new URL(
          "http://georgetown:8080/soap/servlet/rpcrouter");
    
      Call call = new Call();
      
      call.setTargetObjectURI("urn:SampleFaultService");
      call.setMethodName("generateFault");
      try {
         Response resp = call.invoke(url, "");
         if (resp.generatedFault()) {
            String code = resp.getFault().getFaultCode();
            String desc = resp.getFault().getFaultString();
            System.out.println(code + ": " + desc);         }
         else {
            Parameter ret = resp.getReturnValue();
            Object value = ret.getValue();
            System.out.println(value);
         }
      }
      catch (SOAPException e) {
         System.err.println("Caught SOAPException (" +
                         e.getFaultCode() + "): " +
                         e.getMessage());
      }