[ 
https://issues.apache.org/jira/browse/AXIS2C-1573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Lazarski resolved AXIS2C-1573.
-------------------------------------
    Fix Version/s: 2.0.0
       Resolution: Fixed

Implement wsdl2c_sanitize_c_identifier() to convert WSDL type names with
   invalid C characters into valid C identifiers. This fix addresses:

   - AXIS2C-1573: Period (.) in type names - "Test.Types" -> "Test_Types"
   - AXIS2C-433: Hyphen (-) in type names - "my-type" -> "my_type"
   - AXIS2C-1616: Reserved keyword conflicts - "type" -> "type_value"

   Changes:
   - Add wsdl2c_sanitize_c_identifier() function with character mapping
   - Add wsdl2c_is_reserved_keyword() for C/C++/Axis2 keyword detection
   - Extend wsdl2c_schema_element_t with c_name and c_type fields for
     dual name storage (sanitized for C, original for XML serialization)
   - Add comprehensive test suite covering all sanitization scenarios

   The sanitization preserves original XML names for xsi:type serialization
   while using sanitized names for C code generation, maintaining wire
   compatibility.


> Generated code failed to compile when the type names in WSDL has '.'
> --------------------------------------------------------------------
>
>                 Key: AXIS2C-1573
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1573
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: code generation
>    Affects Versions: 1.6.0
>            Reporter: Hengli Wang
>            Priority: Major
>             Fix For: 2.0.0
>
>
> My WSDL file has a simple type that has '.' in its name
> <wsdl:definitions  ...>
>     <wsdl:types>
>         <xs:schema ...>
>             <xs:simpleType name="Test.Types">
>                 <xs:restriction base="xs:string">
>                     <xs:enumeration value="TEST_TYPE_UNKNOWN"/>
>                     <xs:enumeration value="TEST_TYPE_A"/>
>                     <xs:enumeration value="TEST_TYPE_B"/>
>                 </xs:restriction>
>             </xs:simpleType>
>     ...
> The generated code has 
>         /* Enumeration for this type */
>         typedef enum {
>             TEST_TYPE_UNKNOWN,
>             TEST_TYPE_A,
>             TEST_TYPE_B } adb_Test.Types_enum_t;
> A close look shows that the name comes from CADBBeanTemplateHeader.xsl and 
> CADBBeanTemplateSource.xsl,
>                <xsl:variable name="enum">adb_<xsl:value-of 
> select="$propertyName"/>_enum_t</xsl:variable>
> I replaced adb_<xsl:value-of select="$propertyName"/> with<xsl:value-of 
> select="$axis2_name"/>, and the generated code seems happy,
>         /* Enumeration for this type */
>         typedef enum {
>             TEST_TYPE_UNKNOWN,
>             TEST_TYPE_A,
>             TEST_TYPE_B } adb_Test_Types_enum_t;



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to