Hi,

I've tried to come up with a simple, step-by-step HOWTO for a first SOAP 
application that starts from a vanilla Axis beta 2 installation. When I 
try to run the client, I get the following error: "The AXIS engine could 
not find a target service to invoke!  targetService is null"

Would someone be so kind to tell me what I am doing wrong?

BTW: it would be nice if the docs had a more consistent example like 
this. Feel free to use my HOWTO as a skeleton.

Please reply to me directly. I'm not subscribed to this mailing list.

Thanks,
Arno

Assumptions: $AXIS_HOME is the directory that contains Axis beta2
LICENSE file. $TMP is a temporary directory.


- add $AXIS_HOME/lib/*.jar to $CLASSPATH
- go to a temp dir $TMP and create a file Calculator.java

  // Calculator.java
  public interface Calculator {
    public int add(int i1, int i2);
    public int subtract(int i1, int i2);
  }

- go to a temp dir $TMP and create a file CalculatorImpl.java

  // CalculatorImpl.java
  public class CalculatorImpl implements Calculator {
    public int add(int i1, int i2)
    {
      return i1 + i2; 
    }
  
    public int subtract(int i1, int i2)
    {
      return i1 - i2;
    }
  }

# compile Java classes
cd $TMP
javac -g *.java

# Create WSDL
java org.apache.axis.wsdl.Java2WSDL -o Calc.wsdl  -l"http://localhost:8080/axis/Calc"; 
Calculator

# Create stubs and skeletons from WSDL
java org.apache.axis.wsdl.WSDL2Java -o proxies -s Calc.wsdl

# Provide implementation for server. For this simple
# example just manually hand-code implementation for add and sub
vi $TMP/proxies/DefaultNamespace/CalcSoapBindingImpl.java

# Compile proxies
cd $TMP/proxies/DefaultNamespace
javac *.java

# Copy proxies and implementation
cd $AXIS_HOME/webapps/axis/WEB-INF/classes
mkdir Calc
cp -r $TMP/proxies/DefaultNamespace/*.class Calc

# Start the simple Axis server
cd $AXIS_HOME
java org.apache.axis.transport.http.SimpleAxisServer

# Open a new shell and deploy the application
cd $TMP/proxies/DefaultNamespace
java org.apache.axis.client.AdminClient deploy.wsdd

# Write a simple client that makes use of the client stub
cd $TMP/proxies
vi Client.java

// Client.java
import org.apache.axis.AxisFault;
import DefaultNamespace.*;

public class Client
{
    public static void main (String[] args)
    {
        CalculatorServiceLocator loc = new CalculatorServiceLocator();
        Calculator stub = null;
 
        try {
            stub = loc.getCalc();
            System.out.println (stub.add (3, 4));
        } catch (Exception ex) {
             System.out.println ("ERROR: " + ex.toString());
        }
    }
}

# Compile client
javac Client.java

# run Client
java Client

Reply via email to