Hi,

I am a newbie trying to create a RPC-based Web Service. I created this using Axis2 (latest nightly build dated 5th July). The problem is that I cannot use WSDL2Java to generate the Client stubs. So what I did is to use the old Axis (1.4 from 22nd April) to do this.

For some reason I don't get it to work. My Client code looks like this:

package org.apache.ws.axis;

import javax.xml.namespace.*;
import javax.xml.rpc.*;
import java.rmi.*;
import java.net.*;

public class Client2 {
   
    public Client2() {}
   
    interface MyPrimeHandler extends Remote {
        public String echo(String echostring) throws RemoteException;
    }
   
    public void invokeService() {
        String msg = "Det funkar";
        try {
            String wsdlLoc = "http://localhost:8080/axis2/services/MyService2?wsdl";
            QName serviceName = new QName("http://localhost:8080/axis2/services/MyService2", "MyService2");
            ServiceFactory sFactory = ServiceFactory.newInstance();
            Service service = sFactory.createService(new URL(wsdlLoc), serviceName);
            MyPrimeHandler mp = (MyPrimeHandler)service.getPort(MyPrimeHandler.class);
            String resp = mp.echo(msg);
            System.out.println(resp);
        }
       
        catch (Exception e) { e.printStackTrace();}
    }
   
    public static void main(String[] args) {
        Client2 cl2 = new Client2();
        cl2.invokeService();
    }
   
}

The exception that I get is:

- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
javax.xml.rpc.ServiceException: Error processing WSDL document: 
javax.xml.rpc.ServiceException: Error processing WSDL document: 
javax.xml.rpc.ServiceException: Cannot find service:  {http://localhost:8080/axis2/services/MyService2}MyService2
    at org.apache.axis.client.Service.initService(Service.java:250)
    at org.apache.axis.client.Service.<init>(Service.java:165)
    at org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
    at org.apache.ws.axis.Client2.invokeService(Client2.java:22)
    at org.apache.ws.axis.Client2.main(Client2.java:33)


I have checked and the EPR exists at the specified URL above.

Does anyone have an idea on how I should solve this problem? Or am I barking up the wrong tree? Perhaps there is some other way generating client stubs with Axis2? Any help would be appreciated.

Regards

Reply via email to