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 "Robert Simmons Jr." <ro...@jambit.com> on 2004/11/23 13:11:32 UTC

Axis Newbie: I dont get it about JAXRPC

When I look at the examples for JAX RPC calls, I just dont get what is 
going on there. I tried to emulate the examples and call the Version 
service and I get something like the following:

import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import org.apache.axis.version.VersionService;

public class CandiedServices {
    public static void main(final String[] args) {
        try {
            URL urlWsdl = new 
URL("http://localhost:8080/Candied_Services/services/Version?wsdl");
            String nameSpaceUri = 
"http://localhost:8080/Candied_Services/services/Version";
            String serviceName = "VersionService";
            String portName = "Version";
           
            ServiceFactory serviceFactory = ServiceFactory.newInstance();
            Service service = serviceFactory.createService(urlWsdl, new
                    QName(nameSpaceUri, serviceName));
            VersionService versionProxy = (VersionService) 
service.getPort(new
                    QName(nameSpaceUri, portName), VersionService.class);
            System.out.println(versionProxy.getVersion());
        } catch (final Exception ex) {
            System.err.println(ex.toString());
        }
    }
}

The in my build.xml i run the following target:

    <target name="generate.RPC-Client"
            depends="init"
            description="Generate RPC binding classes for the client">
        <wsdl2java 
url="${server.baseurl}/Candied_Services/services/Version?wsdl"
                   output="${src.generated.client}"
                   serverside="no">
            <mapping 
namespace="http://localhost:8080/Candied_Services/services/Version"
                     package="org.apache.axis.version" />
        </wsdl2java>
    </target>

Now I have everything set up, right? Except when I attempt to run the 
client code I get the following:

javax.xml.rpc.ServiceException: Only interfaces which extend 
java.rmi.Remote may be used for the proxy class argument

Now I dont have any idea what is going on but I can use the 
VersionLocator object to call the service directly. However, Im not sure 
whether that is a good idea or not. I am completely lost on what I am 
supposed to do. Please help.

-- Robert