You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Bill Mitchell (JIRA)" <ji...@apache.org> on 2007/12/19 21:57:43 UTC

[jira] Created: (AXIS2C-849) Generated stub for SimpleType List of String returns no contents

Generated stub for SimpleType List of String returns no contents
----------------------------------------------------------------

                 Key: AXIS2C-849
                 URL: https://issues.apache.org/jira/browse/AXIS2C-849
             Project: Axis2-C
          Issue Type: Improvement
          Components: code generation
    Affects Versions: Current (Nightly)
         Environment: Windows XP, Visual Studio 2005, guththila parser, libcurl, WSDL2C from nightly build of 12/19/07
            Reporter: Bill Mitchell
         Attachments: adb_MethodListType.c, adb_MethodListType.h, adb_MethodListType.orig.c

The WSDL fragment below illustrates a SimpleType declared as a list of strings that is returned as an attribute in a response message.  In the generated stubs, the deserialize routine in adb_getExemplarResponse.c nicely expects the MethodListType to deserialize the attribute string into an object and stores the returned MethodListType object as a property of the response.  Yet the generated adb_MethodListType.c doesn't have any properties and has essentially empty routines for the deserialize_from_string and serialize_to_string procedures.  

            <simpleType name="MethodListType">
                <list itemType="string"/>
            </simpleType>
...
            <element name="getExemplarResponse">
                <complexType>
                    <complexContent>
                        <restriction base="anyType">
                            <sequence>
                                <element name="exemplar" minOccurs="1" maxOccurs="1">
                                    <complexType>
                                        <sequence>
                                            <any namespace="##local" minOccurs="1" maxOccurs="unbounded"/>
                                        </sequence>
                                        <attribute name="handle" type="string" use="required"/>
                                    </complexType>
                                </element>
                            </sequence>
                            <attribute name="responseCode" type="integer" use="optional" default="0"/>
                            <attribute name="responseMessage" type="string" use="optional"/>
                            <attribute name="supportedMethods" type="fw:MethodListType" use="optional"/>
                        </restriction>
                    </complexContent>
                </complexType>
            </element>


-- 
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


[jira] Updated: (AXIS2C-849) Generated stub for SimpleType List of String returns no contents

Posted by "Bill Mitchell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Mitchell updated AXIS2C-849:
---------------------------------

    Attachment: adb_MethodListType.h
                adb_MethodListType.c
                adb_MethodListType.orig.c

The attached adb_MethodListType.orig.c shows the essentially empty type currently generated by WSDL2C.  In the attached adb_MethodListType.c and adb_MethodListType.h, I have provided a sample implementation of what this routine should do, at least in the case of a list of strings.

Essentially this consists of:
(1) The usual infrastructure for handling an array of somethings as an attribute of the type, herein named _extraAttribute.    
(2) In the deserialize_from_string, use strtok() to parse the attribute string into individuals items, copy each such item into a new string and include it in the property array
(3) In the serialize_to_string, concatenate all of the strings from the property array into a single string with space separators.  (I chose to return an empty string rather than a zero pointer when the array is empty, to distinguish the successful but empty case from the memory allocation failure case.)
(4) In set_extraAttribute_at, free the cell containing the old string, if any, before taking ownership of the new string
(5) In reset_extraAttribute and set_extraAttribute_nil, free the cells containing any owned strings before freeing the property array

There is really very little new here, not already generated for sequences of elements, except the heart of the deserialize_from_string and serialize_to_string routines.  I'm sure, in the general case, this could be made more functional to return an array of ints or floats.  But as a first pass returning an array of strings for any simpleType that is a List makes the contents accessible to the client.  

I have exercised the included code in both the deserialize and serialize paths.

> Generated stub for SimpleType List of String returns no contents
> ----------------------------------------------------------------
>
>                 Key: AXIS2C-849
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-849
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: code generation
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila parser, libcurl, WSDL2C from nightly build of 12/19/07
>            Reporter: Bill Mitchell
>         Attachments: adb_MethodListType.c, adb_MethodListType.h, adb_MethodListType.orig.c
>
>
> The WSDL fragment below illustrates a SimpleType declared as a list of strings that is returned as an attribute in a response message.  In the generated stubs, the deserialize routine in adb_getExemplarResponse.c nicely expects the MethodListType to deserialize the attribute string into an object and stores the returned MethodListType object as a property of the response.  Yet the generated adb_MethodListType.c doesn't have any properties and has essentially empty routines for the deserialize_from_string and serialize_to_string procedures.  
>             <simpleType name="MethodListType">
>                 <list itemType="string"/>
>             </simpleType>
> ...
>             <element name="getExemplarResponse">
>                 <complexType>
>                     <complexContent>
>                         <restriction base="anyType">
>                             <sequence>
>                                 <element name="exemplar" minOccurs="1" maxOccurs="1">
>                                     <complexType>
>                                         <sequence>
>                                             <any namespace="##local" minOccurs="1" maxOccurs="unbounded"/>
>                                         </sequence>
>                                         <attribute name="handle" type="string" use="required"/>
>                                     </complexType>
>                                 </element>
>                             </sequence>
>                             <attribute name="responseCode" type="integer" use="optional" default="0"/>
>                             <attribute name="responseMessage" type="string" use="optional"/>
>                             <attribute name="supportedMethods" type="fw:MethodListType" use="optional"/>
>                         </restriction>
>                     </complexContent>
>                 </complexType>
>             </element>

-- 
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


[jira] Resolved: (AXIS2C-849) Generated stub for SimpleType List of String returns no contents

Posted by "Dimuthu Gamage (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dimuthu Gamage resolved AXIS2C-849.
-----------------------------------

    Resolution: Fixed

Fixed (AXIS2/Java SVN 607752)

> Generated stub for SimpleType List of String returns no contents
> ----------------------------------------------------------------
>
>                 Key: AXIS2C-849
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-849
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: code generation
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila parser, libcurl, WSDL2C from nightly build of 12/19/07
>            Reporter: Bill Mitchell
>         Attachments: adb_MethodListType.c, adb_MethodListType.h, adb_MethodListType.orig.c, simple_type_list.tar.gz, unrolled.wsdl
>
>
> The WSDL fragment below illustrates a SimpleType declared as a list of strings that is returned as an attribute in a response message.  In the generated stubs, the deserialize routine in adb_getExemplarResponse.c nicely expects the MethodListType to deserialize the attribute string into an object and stores the returned MethodListType object as a property of the response.  Yet the generated adb_MethodListType.c doesn't have any properties and has essentially empty routines for the deserialize_from_string and serialize_to_string procedures.  
>             <simpleType name="MethodListType">
>                 <list itemType="string"/>
>             </simpleType>
> ...
>             <element name="getExemplarResponse">
>                 <complexType>
>                     <complexContent>
>                         <restriction base="anyType">
>                             <sequence>
>                                 <element name="exemplar" minOccurs="1" maxOccurs="1">
>                                     <complexType>
>                                         <sequence>
>                                             <any namespace="##local" minOccurs="1" maxOccurs="unbounded"/>
>                                         </sequence>
>                                         <attribute name="handle" type="string" use="required"/>
>                                     </complexType>
>                                 </element>
>                             </sequence>
>                             <attribute name="responseCode" type="integer" use="optional" default="0"/>
>                             <attribute name="responseMessage" type="string" use="optional"/>
>                             <attribute name="supportedMethods" type="fw:MethodListType" use="optional"/>
>                         </restriction>
>                     </complexContent>
>                 </complexType>
>             </element>

-- 
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


[jira] Updated: (AXIS2C-849) Generated stub for SimpleType List of String returns no contents

Posted by "Bill Mitchell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Mitchell updated AXIS2C-849:
---------------------------------

    Attachment: unrolled.wsdl

> Generated stub for SimpleType List of String returns no contents
> ----------------------------------------------------------------
>
>                 Key: AXIS2C-849
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-849
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: code generation
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila parser, libcurl, WSDL2C from nightly build of 12/19/07
>            Reporter: Bill Mitchell
>         Attachments: adb_MethodListType.c, adb_MethodListType.h, adb_MethodListType.orig.c, unrolled.wsdl
>
>
> The WSDL fragment below illustrates a SimpleType declared as a list of strings that is returned as an attribute in a response message.  In the generated stubs, the deserialize routine in adb_getExemplarResponse.c nicely expects the MethodListType to deserialize the attribute string into an object and stores the returned MethodListType object as a property of the response.  Yet the generated adb_MethodListType.c doesn't have any properties and has essentially empty routines for the deserialize_from_string and serialize_to_string procedures.  
>             <simpleType name="MethodListType">
>                 <list itemType="string"/>
>             </simpleType>
> ...
>             <element name="getExemplarResponse">
>                 <complexType>
>                     <complexContent>
>                         <restriction base="anyType">
>                             <sequence>
>                                 <element name="exemplar" minOccurs="1" maxOccurs="1">
>                                     <complexType>
>                                         <sequence>
>                                             <any namespace="##local" minOccurs="1" maxOccurs="unbounded"/>
>                                         </sequence>
>                                         <attribute name="handle" type="string" use="required"/>
>                                     </complexType>
>                                 </element>
>                             </sequence>
>                             <attribute name="responseCode" type="integer" use="optional" default="0"/>
>                             <attribute name="responseMessage" type="string" use="optional"/>
>                             <attribute name="supportedMethods" type="fw:MethodListType" use="optional"/>
>                         </restriction>
>                     </complexContent>
>                 </complexType>
>             </element>

-- 
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


[jira] Updated: (AXIS2C-849) Generated stub for SimpleType List of String returns no contents

Posted by "Dimuthu Gamage (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2C-849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dimuthu Gamage updated AXIS2C-849:
----------------------------------

    Attachment: simple_type_list.tar.gz

This is fixed in the latest svn. The attachment is a simple test case.
Thanks Bill for the sample implementation. 

Please see my comments inline to the suggestions,

(1) The usual infrastructure for handling an array of somethings as an attribute of the type, herein named _extraAttribute.
- I used the same name as the class

(2) In the deserialize_from_string, use strtok() to parse the attribute string into individuals items, copy each such item into a new string and include it in the property array

I used manual 'for' loop incrementing the string pointer and checking delimit,(Works at least for ASCII), because strtok is not thread-safe,

(3) In the serialize_to_string, concatenate all of the strings from the property array into a single string with space separators. (I chose to return an empty string rather than a zero pointer when the array is empty, to distinguish the successful but empty case from the memory allocation failure case.)
- Done

(4) In set_extraAttribute_at, free the cell containing the old string, if any, before taking ownership of the new string
-DONE
(5) In reset_extraAttribute and set_extraAttribute_nil, free the cells containing any owned strings before freeing the property array 
-DONE

> Generated stub for SimpleType List of String returns no contents
> ----------------------------------------------------------------
>
>                 Key: AXIS2C-849
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-849
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: code generation
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila parser, libcurl, WSDL2C from nightly build of 12/19/07
>            Reporter: Bill Mitchell
>         Attachments: adb_MethodListType.c, adb_MethodListType.h, adb_MethodListType.orig.c, simple_type_list.tar.gz, unrolled.wsdl
>
>
> The WSDL fragment below illustrates a SimpleType declared as a list of strings that is returned as an attribute in a response message.  In the generated stubs, the deserialize routine in adb_getExemplarResponse.c nicely expects the MethodListType to deserialize the attribute string into an object and stores the returned MethodListType object as a property of the response.  Yet the generated adb_MethodListType.c doesn't have any properties and has essentially empty routines for the deserialize_from_string and serialize_to_string procedures.  
>             <simpleType name="MethodListType">
>                 <list itemType="string"/>
>             </simpleType>
> ...
>             <element name="getExemplarResponse">
>                 <complexType>
>                     <complexContent>
>                         <restriction base="anyType">
>                             <sequence>
>                                 <element name="exemplar" minOccurs="1" maxOccurs="1">
>                                     <complexType>
>                                         <sequence>
>                                             <any namespace="##local" minOccurs="1" maxOccurs="unbounded"/>
>                                         </sequence>
>                                         <attribute name="handle" type="string" use="required"/>
>                                     </complexType>
>                                 </element>
>                             </sequence>
>                             <attribute name="responseCode" type="integer" use="optional" default="0"/>
>                             <attribute name="responseMessage" type="string" use="optional"/>
>                             <attribute name="supportedMethods" type="fw:MethodListType" use="optional"/>
>                         </restriction>
>                     </complexContent>
>                 </complexType>
>             </element>

-- 
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


[jira] Commented: (AXIS2C-849) Generated stub for SimpleType List of String returns no contents

Posted by "Bill Mitchell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2C-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555246#action_12555246 ] 

Bill Mitchell commented on AXIS2C-849:
--------------------------------------

Great, Dimuthu.  I rebuilt the stubs, adapted my client to the changed names, and everything worked fine.  

I only used strtok() because the Microsoft Visual Studio documentation suggested it was thread safe, just not usable for different strings at the same time.  That may be unique to Microsoft, though.  Regardless of whether it is thread-safe, you are correct that it is not a good idea in a library routine where the client might be using strtok for his own purposes.  So avoiding its use is a definite improvement.  

> Generated stub for SimpleType List of String returns no contents
> ----------------------------------------------------------------
>
>                 Key: AXIS2C-849
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-849
>             Project: Axis2-C
>          Issue Type: Improvement
>          Components: code generation
>    Affects Versions: Current (Nightly)
>         Environment: Windows XP, Visual Studio 2005, guththila parser, libcurl, WSDL2C from nightly build of 12/19/07
>            Reporter: Bill Mitchell
>         Attachments: adb_MethodListType.c, adb_MethodListType.h, adb_MethodListType.orig.c, simple_type_list.tar.gz, unrolled.wsdl
>
>
> The WSDL fragment below illustrates a SimpleType declared as a list of strings that is returned as an attribute in a response message.  In the generated stubs, the deserialize routine in adb_getExemplarResponse.c nicely expects the MethodListType to deserialize the attribute string into an object and stores the returned MethodListType object as a property of the response.  Yet the generated adb_MethodListType.c doesn't have any properties and has essentially empty routines for the deserialize_from_string and serialize_to_string procedures.  
>             <simpleType name="MethodListType">
>                 <list itemType="string"/>
>             </simpleType>
> ...
>             <element name="getExemplarResponse">
>                 <complexType>
>                     <complexContent>
>                         <restriction base="anyType">
>                             <sequence>
>                                 <element name="exemplar" minOccurs="1" maxOccurs="1">
>                                     <complexType>
>                                         <sequence>
>                                             <any namespace="##local" minOccurs="1" maxOccurs="unbounded"/>
>                                         </sequence>
>                                         <attribute name="handle" type="string" use="required"/>
>                                     </complexType>
>                                 </element>
>                             </sequence>
>                             <attribute name="responseCode" type="integer" use="optional" default="0"/>
>                             <attribute name="responseMessage" type="string" use="optional"/>
>                             <attribute name="supportedMethods" type="fw:MethodListType" use="optional"/>
>                         </restriction>
>                     </complexContent>
>                 </complexType>
>             </element>

-- 
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