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 Daryl Williams <da...@weblane.com> on 2003/06/01 17:25:31 UTC
added new method to service, got: NoSuchMethodError
hello folks, i am new to axis, but have managed to impliment a simple
service
that returns a vector of hashmaps. the service has 1 method, called
getPackageList
and it works fine. i now have a new version that has 2 methods,
getPackageList
and getLibraryList both of which return vectors of hashmaps. while the
service
still returns the list of packages, it fails when going for the list of
libraries
with the following error:
Exception in thread "main" java.lang.NoSuchMethodError:
pkg_librarian.axis.client.PackageLibrarian.getLibraryList()Ljava/util/Vector;
at pkg_librarian.sampleClient.main(sampleClient.java:28)
but, i know that the method in question exists... this service is
implimented
as a .jws file (i.e. /axis/PackageLibrarian.jws). the wsdl file was
generated
using axis' Java2WSDL and the client code was generated using WSDL2Java.
the wdsl, client code and server code is included below.
i have read all documentation i could find without results. your help
would be greatly appreciated.
daryl
//----------- WSDL: PackageLibrarian.wsdl -----------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:PackageLibrarian"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:PackageLibrarian" xmlns:intf="urn:PackageLibrarian"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="urn:PackageLibrarian"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<element name="ArrayOf_xsd_string" nillable="true"
type="impl:ArrayOf_xsd_string"/>
</schema>
<schema targetNamespace="http://xml.apache.org/xml-soap"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Vector">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item"
type="xsd:anyType"/>
</sequence>
</complexType>
<element name="Vector" nillable="true" type="apachesoap:Vector"/>
</schema>
</wsdl:types>
<wsdl:message name="getPackageListResponse">
<wsdl:part name="getPackageListReturn" type="apachesoap:Vector"/>
</wsdl:message>
<wsdl:message name="mainRequest">
<wsdl:part name="in0" type="impl:ArrayOf_xsd_string"/>
</wsdl:message>
<wsdl:message name="getPackageListRequest">
</wsdl:message>
<wsdl:message name="getLibraryListRequest">
</wsdl:message>
<wsdl:message name="getLibraryListResponse">
<wsdl:part name="getLibraryListReturn" type="apachesoap:Vector"/>
</wsdl:message>
<wsdl:message name="mainResponse">
</wsdl:message>
<wsdl:portType name="PackageLibrarian">
<wsdl:operation name="main" parameterOrder="in0">
<wsdl:input message="impl:mainRequest" name="mainRequest"/>
<wsdl:output message="impl:mainResponse" name="mainResponse"/>
</wsdl:operation>
<wsdl:operation name="getLibraryList">
<wsdl:input message="impl:getLibraryListRequest"
name="getLibraryListRequest"/>
<wsdl:output message="impl:getLibraryListResponse"
name="getLibraryListResponse"/>
</wsdl:operation>
<wsdl:operation name="getPackageList">
<wsdl:input message="impl:getPackageListRequest"
name="getPackageListRequest"/>
<wsdl:output message="impl:getPackageListResponse"
name="getPackageListResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PackageLibrarianSoapBinding"
type="impl:PackageLibrarian">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="main">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="mainRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PackageLibrarian" use="encoded"/>
</wsdl:input>
<wsdl:output name="mainResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PackageLibrarian" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getLibraryList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getLibraryListRequest">
<wsdl:input name="getLibraryListRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PackageLibrarian" use="encoded"/>
</wsdl:input>
<wsdl:output name="getLibraryListResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PackageLibrarian" use="encoded"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getPackageList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getPackageListRequest">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PackageLibrarian" use="encoded"/>
</wsdl:input>
<wsdl:output name="getPackageListResponse">
<wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:PackageLibrarian" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PackageLibrarianService">
<wsdl:port binding="impl:PackageLibrarianSoapBinding"
name="PackageLibrarian">
<wsdlsoap:address
location="http://weblane.info:8080/axis/PackageLibrarian.jws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
//----------- end WSDL: PackageLibrarian.wsdl -----------
//----------- client: sampleClient.java -----------
package pkg_librarian;
import java.util.*;
public class sampleClient
{
public static void main(String [] args) throws Exception
{
// Make a service
pkg_librarian.axis.client.PackageLibrarianService service = new
pkg_librarian.axis.client.PackageLibrarianServiceLocator();
// Now use the service to get a stub which implements the SDI.
pkg_librarian.axis.client.PackageLibrarian port =
service.getPackageLibrarian();
pkg_librarian.axis.client.PackageLibrarian pm = new
pkg_librarian.axis.client.PackageLibrarianSoapBindingStub();
System.out.println("Searching for packages...");
Vector pkglist = port.getPackageList();
Enumeration pe = pkglist.elements();
while( pe.hasMoreElements() ) {
HashMap pkg = (HashMap)pe.nextElement();
System.out.println("Package Name: " + pkg.get("name"));
System.out.println(" Version: " + pkg.get("version"));
System.out.println(" URL: " + pkg.get("url"));
System.out.println(" Author: " + pkg.get("author"));
System.out.println(" Description: " + pkg.get("description") + "\n");
}
System.out.println("Searching for libraries...");
pkg_librarian.axis.client.PackageLibrarian port =
service.getPackageLibrarian();
Vector liblist = port.getLibraryList();
Enumeration le = liblist.elements();
while( le.hasMoreElements() ) {
String lib = (String)le.nextElement();
System.out.println("Library: " + lib);
}
}
}
//----------- end client: sampleClient.java -----------
//----------- server: PackageLibrarian.jws -----------
import java.io.*;
import java.util.*;
public class PackageLibrarian {
// our constants...
final private static boolean DEBUG = false;
final private static String METAFILENAME = "META";
final private static String PACKAGE_ROOT = "/tmp/pkgs";
final private static String PATH_SEPARATOR =
System.getProperty("file.separator");
final private static String LIBLIST_FILENAME = "/tmp/lib.list";
private String dirlist[];
private Vector pkglist = new Vector();
private Vector liblist = new Vector();
// constructor
public PackageLibrarian()
{
File pkgroot = new File(PACKAGE_ROOT);
if ( ! pkgroot.isDirectory() ) {
System.err.println(PACKAGE_ROOT + " is NOT a Directory. exiting.");
System.exit(1);
}
else {
this.dirlist = new File(PACKAGE_ROOT).list();
}
// get list of libraries
try {
RandomAccessFile raf = new RandomAccessFile(LIBLIST_FILENAME, "r");
String line;
while ((line = raf.readLine()) != null) {
liblist.addElement(line);
}
}
catch(FileNotFoundException fnf) {
System.err.println("FileNotFoundException: " + LIBLIST_FILENAME);
System.exit(1);
}
catch(IOException io) {
System.err.println(io.toString());
System.exit(1);
}
if (DEBUG) {
Enumeration e = liblist.elements();
while( e.hasMoreElements() ) {
String lib = (String)e.nextElement();
System.err.println("Library: " + lib);
}
}
}
// end of constructor
public Vector getLibraryList()
{
return(this.liblist);
} // end of getPackageList()
public Vector getPackageList()
{
Vector pkglist = new Vector();
for (int i=0; i<this.dirlist.length; i++) {
String fqdir = PACKAGE_ROOT + PATH_SEPARATOR + dirlist[i];
String metafile_name = fqdir + PATH_SEPARATOR + METAFILENAME;
File metafile = new File(metafile_name);
if (DEBUG) {
System.err.println("Package Directory: " + dirlist[i] + " (" +
fqdir + ")");
System.err.println("Package Metafile: " + metafile.toString());
}
String url = "unknown";
String name = "unknown";
String author = "unknown";
String version = "unknown";
String description = "unknown";
if ( metafile.exists() ) {
if (DEBUG) {
System.err.println(" FOUND Metafile.");
}
Properties pkgProps = new Properties();
try {
FileInputStream in = new FileInputStream(metafile_name);
pkgProps.load(in);
in.close();
if ( pkgProps.getProperty("Pkg.url") != null ) {
url = pkgProps.getProperty("Pkg.url");
}
if ( pkgProps.getProperty("Pkg.name") != null ) {
name = pkgProps.getProperty("Pkg.name");
}
if ( pkgProps.getProperty("Pkg.author") != null ) {
author = pkgProps.getProperty("Pkg.author");
}
if ( pkgProps.getProperty("Pkg.version") != null ) {
version = pkgProps.getProperty("Pkg.version");
}
if ( pkgProps.getProperty("Pkg.description") != null ) {
description = pkgProps.getProperty("Pkg.description");
}
if (DEBUG) {
System.err.println(" NAME: " + name);
}
HashMap pkg = new HashMap();
pkg.put("url", url);
pkg.put("name", name);
pkg.put("author", author);
pkg.put("version", version);
pkg.put("description", description);
this.pkglist.addElement(pkg);
}
catch(IOException e) {
System.err.println("IOException!");
System.exit(-1);
}
}
if (DEBUG) {
System.err.print("\n");
}
}
if (DEBUG) {
Enumeration e = this.pkglist.elements();
while( e.hasMoreElements() ) {
HashMap pkg = (HashMap)e.nextElement();
System.err.println("Package Name: " + (String)pkg.get("name"));
}
}
return(this.pkglist);
} // end of getPackageList()
/*
// main
public static void main(String[] args)
{
PackageLibrarian librarian = new PackageLibrarian();
Vector pkglist = librarian.getPackageList();
Vector libraries = librarian.getLibraryList();
System.out.println("Searching for Packages...");
Enumeration e = pkglist.elements();
while( e.hasMoreElements() ) {
HashMap pkg = (HashMap)e.nextElement();
System.err.println("Package Name: " + (String)pkg.get("name"));
}
System.out.println("Searching for Libraries...");
if ( libraries.isEmpty() ) {
System.out.println("Library list is empty...");
}
e = libraries.elements();
while( e.hasMoreElements() ) {
String lib = (String)e.nextElement();
System.err.println("Library: " + lib);
}
}
// end of main()
*/
//----------- end server: PackageLibrarian.jws -----------
} // end of class