axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Mitchell (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2C-779) WSDL2C generates invalid function prototypes when WSDL operation name is a C/C++ reserved word
Date Tue, 20 Nov 2007 17:54:43 GMT
WSDL2C generates invalid function prototypes when WSDL operation name is a C/C++ reserved word
----------------------------------------------------------------------------------------------

                 Key: AXIS2C-779
                 URL: https://issues.apache.org/jira/browse/AXIS2C-779
             Project: Axis2-C
          Issue Type: Improvement
          Components: code generation
    Affects Versions: Current (Nightly)
         Environment: Windows XP, Visual Studio 2005
            Reporter: Bill Mitchell
            Priority: Minor


When given a WSDL with a operation with the name "delete", WSDL2C generates a function prototype
for the operation using "delete" as the name of a formal parameter.  Of course, the C++ compiler
processing the header considers this an invalid use of a reserved word.  

In particular, let the WSDL contain an operation definition of the form:
... 
  <operation name="delete"> 
    <input message="fw:deleteRequest"/> 
    <output message="fw:deleteResponse"/> 
  </operation> 
... 
The generated prototype looks like this:
The template in the header for the stub for this operation is: 
  axiom_node_t* axis2_stub_Fservice_delete( axis2_stub_t *stub, const axutil_env_t *env, 
                                                    axiom_node_t* delete); 

I have verified that the same problem arises with words from the C reserved word list.  If
the operation name is "struct", then the formal parameter name is also "struct", in both the
generated .h and .c files.  

At least 3 approaches to resolving the problem are possible:
(1) Always prefix the names used in the formal parameters with a fixed Axis2 string, e.g.,
"op_".  
(2) Replace names with a substitute when they are found to conflict with a word in the C/C++
reserved word list. 
(3) Prefix all names from the WSDL with a string representing the namespace, so that every
name is of the form nsstring_name, where even the default namespace is replaced with some
nsstring.  
Where solution (3) might solve a general class of conflcts of names across namespaces as well
as this specific issue, for this one issue of the formal parameter to the operation stub solution
(1) should be adequate.  

The workaround, where the user is not able to change the WSDL itself, is to hand massage the
generated .h and .c files after code generation wherever the conflict arises and the compiler
diagnoses the error.  

-- 
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: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message