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
begin:vcard fn:Robert Simmons Jr n:Simmons Jr;Robert org:jambit GmbH adr;quoted-printable:;;R=C3=B6ntgenstrasse 7;Martinsried;;82152;Germany email;internet:[EMAIL PROTECTED] title:Senior Software Architect / Consultant note:Author: "Hardcore Java", O'Reilly and Associates, (2004) http://www.oreilly.com/catalog/hardcorejv/index.html x-mozilla-html:TRUE url:http://www.jambit.com version:2.1 end:vcard