You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by NY...@aol.com on 2004/07/01 17:05:45 UTC

Urgent & Desperate Help with My Axis Client

Hello,
 
I am in desperate need of some assistance with my Axis client. I would be  
ecstatic if somebody would be generous enough to help me! Even just a glance at  
this code would work! 
 
I have a properly deployed web service in Axis and I am trying to write a  
client that utilizes it. I recieve the following error, however, among running  
the compiled program:
 
javax.xml.rpc.ServiceException: Error processing WSDL  document:
java.net.ConnectException: Connection refused:  connect
at  org.apache.axis.client.Service.initService(Service.java:278)
at  org.apache.axis.client.Service.<init>(Service.java:193)
at  
org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:232)
at  
localhost.axis.services.adminHandlerServicePort.adminHandlerClient2.main(adminHandlerClient2.java:3
 
This is my client, I have abbreviated in some places for clarity and  
conveinance however this is everything having to do with accessing the  server:
 
public class adminHandlerClient2
{
static String router = "_http://localhost:8081/axis/adminDirect_ 
(http://localhost:8081/axis/adminDirect) ";
static String service =  "adminDirectService.wsdl";   
static String  endpoint = "_http://localhost:8080/axis/servlet/AxisServlet_ 
(http://localhost:8080/axis/servlet/AxisServlet) ";
static String 
url="_http://localhost:8080/axis/services/adminHandlerServicePort_ (http://localhost:8080/axis/services/adminHandlerServicePort) ";

public static void  main(String[] args)
{
try
{
ServiceFactory sf =  ServiceFactory.newInstance();
URL u = new URL(router + "/" +  service);
QName  serviceName = new  QName(url,"adminHandlerService");
Service s = sf.createService(u,serviceName);

Call call =  (Call)s.createCall();

call.setTargetEndpointAddress(new  URL(endpoint));
call.setOperationName(new QName("postReport"));
 
            //Checking for proper syntax of  call
if  (args.length==0)
{
System.err.println("Incorrect  usage of Client. Please use the following:");
System.err.println("adminHandlerClient" + " [Group Name]" + "    [Password]" 
+ "   [Account Name]" + "   [XML Path]"  );
}
else
{
System.out.println("Thank You. Processing. . .");
 
                 String groupName = args[0];
String password =  args[1];
String accountName =  args[2];
String xmlData =  readFile(args[3]);
 
          call.invoke(new Object [] {groupName, password, accountName,  
xmlData});
}
}
catch(Exception  e)
{
System.err.println("Error running  Client:");
e.printStackTrace();
}
}
}
 
I look forward to hearing from you!
James!

Re: Urgent & Desperate Help with My Axis Client

Posted by Jeff <je...@cogentlogic.com>.
Hi James,

"http://localhost:8080/axis/servlet/AxisServlet" doesn't look right for your endpoint. I would expect something like "http://localhost:8080/axis/services/<service name>";


Jeff


  ----- Original Message ----- 
  From: NYY96@aol.com 
  To: axis-user@ws.apache.org ; axis-dev@ws.apache.org 
  Sent: Thursday, July 01, 2004 11:05 AM
  Subject: Urgent & Desperate Help with My Axis Client


  Hello,

  I am in desperate need of some assistance with my Axis client. I would be ecstatic if somebody would be generous enough to help me! Even just a glance at this code would work! 

  I have a properly deployed web service in Axis and I am trying to write a client that utilizes it. I recieve the following error, however, among running the compiled program:

  javax.xml.rpc.ServiceException: Error processing WSDL document:
  java.net.ConnectException: Connection refused: connect
          at org.apache.axis.client.Service.initService(Service.java:278)
          at org.apache.axis.client.Service.<init>(Service.java:193)
          at org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:232)
          at localhost.axis.services.adminHandlerServicePort.adminHandlerClient2.main(adminHandlerClient2.java:3

  This is my client, I have abbreviated in some places for clarity and conveinance however this is everything having to do with accessing the server:

  public class adminHandlerClient2
  {
      static String router = "http://localhost:8081/axis/adminDirect";
      static String service = "adminDirectService.wsdl";   
      static String endpoint = "http://localhost:8080/axis/servlet/AxisServlet";
      static String url="http://localhost:8080/axis/services/adminHandlerServicePort";
     
      public static void main(String[] args)
      {
         try
         {
             ServiceFactory sf = ServiceFactory.newInstance();
             URL u = new URL(router + "/" + service);
             QName serviceName = new QName(url,"adminHandlerService");
             Service s = sf.createService(u,serviceName);
     
             Call call = (Call)s.createCall();
   
             call.setTargetEndpointAddress(new URL(endpoint));
             call.setOperationName(new QName("postReport"));

             //Checking for proper syntax of call
             if (args.length==0)
      {
              System.err.println("Incorrect usage of Client. Please use the following:");
     System.err.println("adminHandlerClient" + " [Group Name]" + "   [Password]" + "   [Account Name]" + "   [XML Path]" );
             }
             else
         {
                  System.out.println("Thank You. Processing. . .");

                  String groupName = args[0];
        String password = args[1];
        String accountName = args[2];
        String xmlData = readFile(args[3]);

           call.invoke(new Object [] {groupName, password, accountName, xmlData});
      }
          }
   catch(Exception e)
   {
    System.err.println("Error running Client:");
    e.printStackTrace();
   }
      }
  }

  I look forward to hearing from you!
  James!