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 Jay Glanville <Ja...@naturalconvergence.com> on 2005/03/07 19:42:40 UTC

how can I export constants

I have a class with public internal constants.  For example:

  Public class TapeDrive {

    public static final int PLAY = 1; 
    public static final int PAUSE = 2; 
    public static final int STOP = 3; 
    public static final int FF = 4; 
    public static final int REW = 5; 

    ...

    public void setAction( int act ) {
    ...

I'm using the bean serializer to export my bean.

I want my soap clients to be able to see these constants so that they
can understand the meanings of the possible values for the setAction()
method.


Is there any way that I can configure my bean so that the constants are
exported?  Or, am I limited because of SOAP (i.e.: does SOAP allow the
concept of constants, or is it limited to just methods and structures?)

Thanks

PS: Please don't say "write a custom serializer", as no one has
effectively answered my questions concerning my problems with custom
serializers
(http://marc.theaimsgroup.com/?l=axis-user&m=111003930120769&w=2)


JDG
 
---
Jay Glanville

Re: how can I export constants

Posted by Anne Thomas Manes <at...@gmail.com>.
Perhaps you shouldn't simply expose the bean. You should expose a more
loosely coupled interface. You should define an enumeration in your
WSDL interface with string values of "play", "pause", "stop", "ff",
and "rew", and when a client sets the action, it should specify one of
these values. Your application should then take this input and set the
appropriate internal constant.

Anne

On Mon, 7 Mar 2005 13:42:40 -0500, Jay Glanville
<Ja...@naturalconvergence.com> wrote:
> I have a class with public internal constants.  For example:
> 
>   Public class TapeDrive {
> 
>     public static final int PLAY = 1;
>     public static final int PAUSE = 2;
>     public static final int STOP = 3;
>     public static final int FF = 4;
>     public static final int REW = 5;
> 
>     ...
> 
>     public void setAction( int act ) {
>     ...
> 
> I'm using the bean serializer to export my bean.
> 
> I want my soap clients to be able to see these constants so that they
> can understand the meanings of the possible values for the setAction()
> method.
> 
> Is there any way that I can configure my bean so that the constants are
> exported?  Or, am I limited because of SOAP (i.e.: does SOAP allow the
> concept of constants, or is it limited to just methods and structures?)
> 
> Thanks
> 
> PS: Please don't say "write a custom serializer", as no one has
> effectively answered my questions concerning my problems with custom
> serializers
> (http://marc.theaimsgroup.com/?l=axis-user&m=111003930120769&w=2)
> 
> JDG
> 
> ---
> Jay Glanville