Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Can a bottom up web service be created from an interface definition ?
Can a bottom up web service be created from an interface definition ? [message #177842] Thu, 24 August 2006 18:23 Go to next message
Gary Mohr is currently offline Gary Mohr
Messages: 25
Registered: July 2009
Junior Member
I have created a Dynamic Web project which contains two source files:

package wtp;
public interface IConverter {
public void Converter ();
public float celsiusToFarenheit ( float celsius );
public float farenheitToCelsius ( float farenheit );
}

package wtp;
public class Converter implements IConverter {
public void Converter () {
return;
}
public float celsiusToFarenheit ( float celsius )
{
return (celsius * 9 / 5) + 32;
}
public float farenheitToCelsius ( float farenheit )
{
return (farenheit - 32) * 5 / 9;
}
}

I am able to create a web service from the class but I have a customer that
would like to be able to create a web service from the interface. Is this
possible ?

When I select this interface file and tell the WTP Web Service wizard to
create a web service from it, I get an error dialog with the following
message:

The service class "wtp.IConverter" does not comply to one or more
requirements of the JAX-RPC 1.1 specification, and may not deploy or
function correctly.
The service class "wtp.IConverter" does not have a public default
constructor. Chapter 10.1 of the JAX-RPC 1.1 specification requires a
service class to have a public default constructor, otherwise a JAX-RPC 1.1
compliant Web service engine may be unable to construct an instance of the
service class to handle an incoming request message.

The dialog box allows me to ignore the error but if I do the next dialog
(which allows the user to select the methods to expose in the web service)
is displayed but no methods are presented in the selection list and the
"Next" and "Finish" buttons are grayed out so you can not proceed beyond
that point in the wizard.

If this is something that is reasonable to do, some guidance would be
appreciated, if not tell me I am crazy and I will go away.

Gary
Re: Can a bottom up web service be created from an interface definition ? [message #177889 is a reply to message #177842] Fri, 25 August 2006 10:26 Go to previous message
Seng Phung Lu is currently offline Seng Phung Lu
Messages: 62
Registered: July 2009
Member
Hi Gary,

Web services cannot be created from a Java interface since they do not
have 'public default constructors' as required by the JAX-RPC 1.1 spec.
A WSDL is practically an interface anyway. What are they trying to
accomplish by using an interface rather than a class?

Seng

Gary Mohr wrote:
> I have created a Dynamic Web project which contains two source files:
>
> package wtp;
> public interface IConverter {
> public void Converter ();
> public float celsiusToFarenheit ( float celsius );
> public float farenheitToCelsius ( float farenheit );
> }
>
> package wtp;
> public class Converter implements IConverter {
> public void Converter () {
> return;
> }
> public float celsiusToFarenheit ( float celsius )
> {
> return (celsius * 9 / 5) + 32;
> }
> public float farenheitToCelsius ( float farenheit )
> {
> return (farenheit - 32) * 5 / 9;
> }
> }
>
> I am able to create a web service from the class but I have a customer that
> would like to be able to create a web service from the interface. Is this
> possible ?
>
> When I select this interface file and tell the WTP Web Service wizard to
> create a web service from it, I get an error dialog with the following
> message:
>
> The service class "wtp.IConverter" does not comply to one or more
> requirements of the JAX-RPC 1.1 specification, and may not deploy or
> function correctly.
> The service class "wtp.IConverter" does not have a public default
> constructor. Chapter 10.1 of the JAX-RPC 1.1 specification requires a
> service class to have a public default constructor, otherwise a JAX-RPC 1.1
> compliant Web service engine may be unable to construct an instance of the
> service class to handle an incoming request message.
>
> The dialog box allows me to ignore the error but if I do the next dialog
> (which allows the user to select the methods to expose in the web service)
> is displayed but no methods are presented in the selection list and the
> "Next" and "Finish" buttons are grayed out so you can not proceed beyond
> that point in the wizard.
>
> If this is something that is reasonable to do, some guidance would be
> appreciated, if not tell me I am crazy and I will go away.
>
> Gary
>
>
Previous Topic:Unable to open any non-Eclipse generated WSDLs
Next Topic:Publish to WebSphere6 fails due to backslash in directory name within WAR
Goto Forum:
  


Current Time: Fri Aug 22 03:57:05 EDT 2014

Powered by FUDForum. Page generated in 0.01803 seconds