You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Sérgio Gomes <se...@gmail.com> on 2008/04/09 16:53:54 UTC

Code generation and enumerations

Hi there,

Yet another possible code generator issue. There's an enumeration in
the WSDL I'm using:

<simpleType name="DayOfWeek" >
   <restriction base="xsd:string">
      <enumeration value="Monday"/>
      <enumeration value="Tuesday"/>
      <enumeration value="Wednesday"/>
      <enumeration value="Thursday"/>
      <enumeration value="Friday"/>
      <enumeration value="Saturday"/>
      <enumeration value="Sunday"/>
   </restriction>
</simpleType>

And the setter that gets generated for it is:

axis2_status_t AXIS2_CALL
adb_DayOfWeek_set_DayOfWeek(
   adb_DayOfWeek_t* _DayOfWeek,
   const axutil_env_t *env,
   const axis2_char_t*  arg_DayOfWeek);

The setter is referencing a structure of the same type, so how can I
create, say, a "Monday" object? Shouldn't the setter be receiving
something like an integer instead, which you could get from a C enum
with the several options?

Cheers,
Sérgio

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: Code generation and enumerations

Posted by Sérgio Gomes <se...@gmail.com>.
Hi Dimuthu,

Thanks for getting back to me. I'll give that patch a try next week,
I'll let you know.

Cheers,
Sérgio

---
On Fri, Apr 11, 2008 at 9:21 PM, Dimuthu Gamage <di...@gmail.com> wrote:
> Hi Sérgio,
>
>  Yea, you are correct on this. We should be able to declare them in an
>  enum to provide interger constants in the API. It should be trivial.
>  Why not you try that and propose a patch?
>
>  If you like to try you have to checkout the axis2/java source code
>  from https://svn.apache.org/repos/asf/webservices/axis2/trunk/java
>
>  and you may need to edit following files
>  c adb templates from
>  modules/adb-codegen/src/org/apache/axis2/schema/template/ in the
>  source tree
>  c adb writer class from
>  modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
>  in the source tree
>
>  Thanks
>  Dimuthu
>
>
>
>  On Wed, Apr 9, 2008 at 8:23 PM, Sérgio Gomes <se...@gmail.com> wrote:
>  > Hi there,
>  >
>  >  Yet another possible code generator issue. There's an enumeration in
>  >  the WSDL I'm using:
>  >
>  >  <simpleType name="DayOfWeek" >
>  >    <restriction base="xsd:string">
>  >       <enumeration value="Monday"/>
>  >       <enumeration value="Tuesday"/>
>  >       <enumeration value="Wednesday"/>
>  >       <enumeration value="Thursday"/>
>  >       <enumeration value="Friday"/>
>  >       <enumeration value="Saturday"/>
>  >       <enumeration value="Sunday"/>
>  >    </restriction>
>  >  </simpleType>
>  >
>  >  And the setter that gets generated for it is:
>  >
>  >  axis2_status_t AXIS2_CALL
>  >  adb_DayOfWeek_set_DayOfWeek(
>  >    adb_DayOfWeek_t* _DayOfWeek,
>  >    const axutil_env_t *env,
>  >    const axis2_char_t*  arg_DayOfWeek);
>  >
>  >  The setter is referencing a structure of the same type, so how can I
>  >  create, say, a "Monday" object? Shouldn't the setter be receiving
>  >  something like an integer instead, which you could get from a C enum
>  >  with the several options?
>  >
>  >  Cheers,
>  >  Sérgio
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>  >  For additional commands, e-mail: axis-c-user-help@ws.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>  For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: Code generation and enumerations

Posted by Dimuthu Gamage <di...@gmail.com>.
Hi Sérgio,

Yea, you are correct on this. We should be able to declare them in an
enum to provide interger constants in the API. It should be trivial.
Why not you try that and propose a patch?

If you like to try you have to checkout the axis2/java source code
from https://svn.apache.org/repos/asf/webservices/axis2/trunk/java

and you may need to edit following files
c adb templates from
modules/adb-codegen/src/org/apache/axis2/schema/template/ in the
source tree
c adb writer class from
modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
in the source tree

Thanks
Dimuthu

On Wed, Apr 9, 2008 at 8:23 PM, Sérgio Gomes <se...@gmail.com> wrote:
> Hi there,
>
>  Yet another possible code generator issue. There's an enumeration in
>  the WSDL I'm using:
>
>  <simpleType name="DayOfWeek" >
>    <restriction base="xsd:string">
>       <enumeration value="Monday"/>
>       <enumeration value="Tuesday"/>
>       <enumeration value="Wednesday"/>
>       <enumeration value="Thursday"/>
>       <enumeration value="Friday"/>
>       <enumeration value="Saturday"/>
>       <enumeration value="Sunday"/>
>    </restriction>
>  </simpleType>
>
>  And the setter that gets generated for it is:
>
>  axis2_status_t AXIS2_CALL
>  adb_DayOfWeek_set_DayOfWeek(
>    adb_DayOfWeek_t* _DayOfWeek,
>    const axutil_env_t *env,
>    const axis2_char_t*  arg_DayOfWeek);
>
>  The setter is referencing a structure of the same type, so how can I
>  create, say, a "Monday" object? Shouldn't the setter be receiving
>  something like an integer instead, which you could get from a C enum
>  with the several options?
>
>  Cheers,
>  Sérgio
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>  For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org