axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Haszlakiewicz, Eric" <EHAS...@transunion.com>
Subject problem with WSDL2C generated code and empty elements
Date Thu, 09 Oct 2008 23:22:45 GMT

I have an element in my schema that is defined like so:
    <xs:simpleType name="foo-type">
        <xs:restriction base="xs:string">
            <xs:minLength value="0"/>
            <xs:maxLength value="10"/>
        </xs:restriction>
    </xs:simpleType>
...
    <xs:element name="myelem" type="tns:foo-type" minOccurs="1"
maxOccurs="1"/>

I have code that generates responses with this element in it using the
adb methods, and that seems to work fine, at least some of the time.
I'm running into problems when the length of the string is 0.  The
element is created, and returned to the client, but the generated
adb_foo_type_deserialize function doesn't handle it correctly.  I think
the fix is fairly simple:

...snip...
    text_node = axiom_node_get_first_child(parent, env);
    if (text_node &&
        axiom_node_get_node_type(text_node, env) == AXIOM_TEXT)
   {
      axiom_text_t *text_element =
(axiom_text_t*)axiom_node_get_data_element(text_node, env);
      if(text_element && axiom_text_get_value(text_element, env))
      {
           text_value =
(axis2_char_t*)axiom_text_get_value(text_element, env);
           status =
adb_address_line_type_deserialize_from_string(_address_line_type, env,
text_value, parent);
       }
   }
...snip...

turns into:
    text_node = axiom_node_get_first_child(parent, env);
    axiom_text_t *text_element;
    if (text_node &&
        axiom_node_get_node_type(text_node, env) == AXIOM_TEXT)
      text_element =
(axiom_text_t*)axiom_node_get_data_element(text_node, env);

   if(text_element && axiom_text_get_value(text_element, env))
      text_value = (axis2_char_t*)axiom_text_get_value(text_element,
env);
   else
      text_value = "";

   status =
adb_address_line_type_deserialize_from_string(_address_line_type, env,
text_value, parent);


Does that make sense?  Should I submit the patch to the stylesheet used
by WSDL2C as a axis2/c bug or a axis2/java bug?

eric

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


Mime
View raw message