axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marella, Purush" <>
Subject Question on using an interface as the return type for a method, i nstead of a concrete class
Date Wed, 07 Jan 2004 21:18:01 GMT


I can use an interface as the return type just fine, but not for multiple
methods, as Axis errors out in the java2wsdl step, saying a namespace
definition is missing.  How do I specify a namespace?  The detailed
description of the problem is as follows:


I have 3 methods (web services) with the signatures

public Box getInbox();

public Box getOutbox();

public Box getHistory();


Box is an interface and BoxImpl is the concrete class that implements it.
If I have only one of the above methods, everything works fine, with only a
warning being generated, that says an xml schema anyType will be used(given
below).  But when I have all 3 methods listed out, I not only get the
warning, but followed by the error:


 [axis-java2wsdl] Java2WSDL

[axis-java2wsdl] - The class does not contain a
default constructor, which is a requirement for a bean class.  The class
cannot be converted into an xml schema type.  An xml schema anyType will be
used to define this class in the wsdl file. [axis-java2wsdl] WSDLException:
faultCode=OTHER_ERROR: Can't find prefix for '
<> '. Namespace prefixes must be set on the
Definition object using the addNamespace(...) method.:


I tried to get around the problem by using concrete "BoxImpl" as the return
type for the methods, and everything works fine, except that wsdl2java
generator is also generating a "" class and is overwriting my
original class.


I would ideally like to get the code working with "Box" return type and not
the Impl.  How do I specify it the namespace it is asking for?


Thanks a lot for taking the time.



View raw message