You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by amy <wx...@ict.ac.cn> on 2002/05/21 05:38:01 UTC

AbstractMethodError when run soap client

Hi,
    I got an exception when I ran the soap client :

  Exception in thread "main" java.lang.AbstractMethodError
        at org.apache.soap.util.xml.QName.<init>(QName.java:80)
        at org.apache.soap.util.xml.QName.matches(QName.java:146)
        at org.apache.soap.Envelope.unmarshall(Envelope.java:237)
        at org.apache.soap.rpc.Call.invoke(Call.java:230)
        at hello.Client.main(Client.java:50)

	And my client code is like that which the line 50 is 
      resp = call.invoke(url, "");
	Anyone who knows the reason,pls help me.thank u.

/////////////////////////////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/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();
      }
   }   
}


        致
礼!
 				
              amy
              wxue@ict.ac.cn
                 2002-05-21