3 bugs in C code generation (invalid characters in c tokens, cyclic inclusion
and uppercase-lowercase mismatch)
---------------------------------------------------------------------------------------------------------------
Key: AXIS2-4816
URL: https://issues.apache.org/jira/browse/AXIS2-4816
Project: Axis2
Issue Type: Bug
Components: adb
Affects Versions: 1.5.1
Environment: Tested on Linux, but shall be present on all platforms
Reporter: Brice André
I have encountered 3 bugs when trying to generate soap c-client code with the
wsdl2c tool.
I create a single issue because I have only one patch for all bugs.
The first bug encountered is the presence of invalid characters in c tokens (in
my case, the '-' character) when a type name containing an enumeration contains
such invalid character. An example of schema that generates this bug is the
following:
<s:simpleType name="Temperature-Unit">
<s:restriction base="s:string">
<s:enumeration value="C"/>
<s:enumeration value="F"/>
<s:enumeration value="R"/>
<s:enumeration value="r"/>
<s:enumeration value="k"/>
</s:restriction>
</s:simpleType>
I think that the solution to this problem is to change the C xml template
filess in order to insert the property for which all invalid characters were
replaced by '_'.
The second problem arrises when generating code with one file per data type on
very large projects : I did not identified which part of the schema was causing
the trouble, but the #include directives are cyclic, which prevents the
compilation of the code.
I think that the solution to this problem is to change the C xml header
template in order to declare the structure of each data type before performing
inclusions.
The third problem encountered arises when an enumeration type contains two
different values that differ only by upper or lowercase characters. The
generated C enum has all fields written in upper-case and so, both elements
have the same name. The sample of wsdl schema written above contains such an
error.
In this case, the solution of the problem is not so trivial. A simple way to
remove it is to keep the case (upper or lower) of the wsdl enumeration in the C
structure. But this change would implies that new generated code will not be
compatible with the previously one. I chose this way for solving the problem
and so, I created a new property, called nu_id (nu stands for non-uppercase),
which contains the original id (with removed invalid characters for c tokens)
and I changed the C xml templates so that this new property is used for code
generation.
I don't see any way of joining files during the creation of an issue, but, when
I will find a way to do so, I will join an example of wsdl file that generates
the three problems as well as a patch that seems to correct all of them. If you
don't find the attached files, fell free to contact me. I will send both files.
I used the following command to generate the code :
WSDL2C.sh -uri ../WSDL/ehealth-hubservices/WSDL/InterHubWebService-1_0.wsdl -u
-o Generated/.
I used the following command to compile the generated elements :
gcc -c -combine -o ${OBJ_DIR}/axis2_stub_InterHubService.o
-I${AXIS2C_HOME}/include src/*.c
Best Regards,
Brice André
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]