You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Unai Estébanez <un...@unainet.net> on 2009/07/24 12:02:27 UTC

Problem in deserialization with WSDL2C generated code

Hi,
I have a problem with my client while I try to deserialize my server
response. Please, could anybody help me?

I generate the server and client code with WSDL2C
client: /usr/local/axis2c/bin/tools/wsdl2c/WSDL2C.sh -uri ./rsu_vars.wsdl
-sp -d adb -uw --noBuildXML
server: /usr/local/axis2c/bin/tools/wsdl2c/WSDL2C.sh -uri ./rsu_vars.wsdl
-ss -sd -sp -d adb -uw --noBuildXML

At the bottom of this message I will include the wsdl I use.

The problem I have is that when I serialize, the automatic generated code,
perform this check: ( I have hand written remarks inside the code )
--- SEVER SERIALIZATION CODE BEGIN ---
.... more code here
                    /*
                     * parsing RT_AnalogVarListSequence element
                     */
                           if(!adb_RT_AnalogVarListSequence_is_particle())
<----- THIS FUNCTIONS ALWAYS DO: "return AXIS2_TRUE;"
                           {
                               axutil_stream_write(stream, env,
start_input_str, start_input_str_len); <-- NEVER INSERTS THE TAG
"<RT_AnalogVarListSequence>"
                           }

 adb_RT_AnalogVarListSequence_serialize((adb_RT_AnalogVarListSequence_t*)element,


    env, current_node, parent_element,

    adb_RT_AnalogVarListSequence_is_particle() || AXIS2_FALSE, namespaces,
next_ns_index);
                           if(!adb_RT_AnalogVarListSequence_is_particle())
                           {
                               axutil_stream_write(stream, env,
end_input_str, end_input_str_len);
                           }
                        }
.... more code here
--- SEVER SERIALIZATION CODE END ---

On the other hand the deserialization code fails because it needs the
<RT_AnalogVarListSequence> tag:
--- CLIENT DESERIALIZATION CODE BEGIN ---
/*
 * building RT_AnalogVarListSequence element
*/
element_qname = axutil_qname_create(env, "RT_AnalogVarListSequence", "
http://www.example.org/rsu_vars/", NULL); <-- CLient expects the
"<RT_AnalogVarListSequence>" tag
for (i = 0, sequence_broken = 0, current_node = first_node; !sequence_broken
&& current_node != NULL;)
{
                                 if(axiom_node_get_node_type(current_node,
env) != AXIOM_ELEMENT)
                                  {
                                     current_node
=axiom_node_get_next_sibling(current_node, env);
                                     is_early_node_valid = AXIS2_FALSE;
                                     continue;
                                  }

                                  current_element = (axiom_element_t
*)axiom_node_get_data_element(current_node, env);
                                  qname =
axiom_element_get_qname(current_element, env, current_node);

                                  if (axutil_qname_equals(element_qname,
env, qname))
                                  {

                                      is_early_node_valid = AXIS2_TRUE;


                                          element =
(void*)adb_RT_AnalogVarListSequence_create(env);

                                          status =
adb_RT_AnalogVarListSequence_deserialize((adb_RT_AnalogVarListSequence_t*)element,
env,

&current_node, &is_early_node_valid, AXIS2_FALSE);

                                          if(AXIS2_FAILURE ==  status)
                                          {
                                              AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in building element RT_AnalogVarListSequence ");
                                          }
                                          else
                                          {

axutil_array_list_add_at(arr_list, env, i, element);
                                          }

                                     if(AXIS2_FAILURE ==  status)
                                     {
                                         AXIS2_LOG_ERROR(env->log,
AXIS2_LOG_SI, "failed in setting the value for RT_AnalogVarListSequence ");
                                         if(element_qname)
                                         {
                                            axutil_qname_free(element_qname,
env);
                                         }
                                         if(arr_list)
                                         {
                                            axutil_array_list_free(arr_list,
env);
                                         }
                                         return AXIS2_FAILURE;
                                     }

                                     i ++;
                                    current_node =
axiom_node_get_next_sibling(current_node, env);
                                  }
                                  else
                                  {
                                     ALWAYS ENTER HERE!!!!
                                      is_early_node_valid = AXIS2_FALSE;
                                      sequence_broken = 1;
                                  }

}
--- CLIENT DESERIALIZATION CODE END ---

--- WSDL BEGIN ---
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/rsu_vars/" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" name="rsu_vars" targetNamespace="
http://www.example.org/rsu_vars/">
 <wsdl:types>
   <xsd:schema targetNamespace="http://www.example.org/rsu_vars/">

       <xsd:complexType name="RT_DigitalVar">
               <xsd:sequence>
                       <xsd:element name="ID_DigitalVar"
type="xsd:string"></xsd:element>
                       <xsd:element name="OwnerType"
type="xsd:string"></xsd:element>
                       <xsd:element name="OwnerCode"
type="xsd:int"></xsd:element>
                       <xsd:element name="RT_TimeStamp"
type="xsd:dateTime"></xsd:element>
                       <xsd:element name="RT_Value"
type="xsd:int"></xsd:element>
                       <xsd:element name="RT_Alm"
type="xsd:int"></xsd:element>
               </xsd:sequence>
       </xsd:complexType>

       <xsd:complexType name="RT_AnalogVar">
               <xsd:sequence>
                       <xsd:element name="ID_AnalogVar"
type="xsd:string"></xsd:element>
                       <xsd:element name="OwnerType"
type="xsd:string"></xsd:element>
                       <xsd:element name="OwnerCode"
type="xsd:int"></xsd:element>
                       <xsd:element name="RT_TimeStamp"
type="xsd:dateTime"></xsd:element>
                       <xsd:element name="RT_Value"
type="xsd:double"></xsd:element>
                       <xsd:element name="RT_Alm"
type="xsd:int"></xsd:element>
               </xsd:sequence>
       </xsd:complexType>

       <xsd:complexType name="ID_Variable">
               <xsd:sequence>
                       <xsd:element name="ID_Var"
type="xsd:string"></xsd:element>
                       <xsd:element name="OwnerType"
type="xsd:string"></xsd:element>
                       <xsd:element name="OwnerCode"
type="xsd:int"></xsd:element>
               </xsd:sequence>
       </xsd:complexType>

       <xsd:element name="IDVariable" type="tns:ID_Variable"></xsd:element>

       <xsd:element name="AnalogicVariable"
type="tns:RT_AnalogVar"></xsd:element>

       <xsd:element name="DigitalVariable"
type="tns:RT_DigitalVar"></xsd:element>

       <xsd:complexType name="RT_AnalogVarList">
               <xsd:sequence minOccurs="1" maxOccurs="255">
                       <xsd:element name="NewElement"
                               type="tns:RT_AnalogVar">
                       </xsd:element>
               </xsd:sequence>
       </xsd:complexType>

       <xsd:complexType name="RT_DigitalVarList">
               <xsd:sequence minOccurs="1" maxOccurs="255">
                       <xsd:element name="NewElement"
                               type="tns:RT_DigitalVar">
                       </xsd:element>
               </xsd:sequence>
       </xsd:complexType>

       <xsd:element name="AnalogicVariableList"
               type="tns:RT_AnalogVarList">
       </xsd:element>

       <xsd:element name="DigitalVariableList"
               type="tns:RT_DigitalVarList">
       </xsd:element>
       <xsd:element name="get_all_digital_variables">
               <xsd:complexType>
                       <xsd:sequence>
                               <xsd:element name="in"
type="xsd:string"></xsd:element>
                       </xsd:sequence>
               </xsd:complexType>
       </xsd:element>
       <xsd:element name="get_all_digital_variablesResponse">
               <xsd:complexType>
                       <xsd:sequence>
                               <xsd:element name="out"
type="xsd:string"></xsd:element>
                       </xsd:sequence>
               </xsd:complexType>
       </xsd:element>
       <xsd:element name="get_all_analogic_variables">
               <xsd:complexType>
                       <xsd:sequence>
                               <xsd:element name="in"
type="xsd:string"></xsd:element>
                       </xsd:sequence>
               </xsd:complexType>
       </xsd:element>
       <xsd:element name="get_all_analogic_variablesResponse">
               <xsd:complexType>
                       <xsd:sequence>
                               <xsd:element name="out"
type="xsd:string"></xsd:element>
                       </xsd:sequence>
               </xsd:complexType>
       </xsd:element>
   </xsd:schema>
 </wsdl:types>
   <wsdl:message name="GetDigitalVariableMsg">
       <wsdl:part name="Parameter"
element="tns:IDVariable"></wsdl:part></wsdl:message>
   <wsdl:message name="DigitalVariableResponseMsg">
       <wsdl:part name="Parameter"
element="tns:DigitalVariable"></wsdl:part></wsdl:message>
   <wsdl:message name="GetAnalogVariableMsg">
       <wsdl:part name="Parameter"
element="tns:IDVariable"></wsdl:part></wsdl:message>
   <wsdl:message name="AnalogVariableResponseMsg">
       <wsdl:part name="Parameter"
element="tns:AnalogicVariable"></wsdl:part></wsdl:message>
   <wsdl:message name="GetAllDigitalVariablesMsg">
   </wsdl:message>
   <wsdl:message name="AllDigitalVariablesResponseMsg">
       <wsdl:part name="parameters"
element="tns:DigitalVariableList"></wsdl:part>
   </wsdl:message>
   <wsdl:message name="GetAllAnalogicVariablesMsg">
   </wsdl:message>
   <wsdl:message name="AllAnalogicVariablesResponseMsg">
       <wsdl:part name="parameters"
element="tns:AnalogicVariableList"></wsdl:part>
   </wsdl:message>
   <wsdl:portType name="vars">
       <wsdl:operation name="get_digital_variables">
               <wsdl:input message="tns:GetDigitalVariableMsg"></wsdl:input>
               <wsdl:output message="tns:DigitalVariableResponseMsg"
name="get_digital_variables_response"></wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="get_analogic_variables">
               <wsdl:input message="tns:GetAnalogVariableMsg"></wsdl:input>
               <wsdl:output message="tns:AnalogVariableResponseMsg"
name="get_analogic_variables_response"></wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="get_all_digital_variables">
           <wsdl:input
               message="tns:GetAllDigitalVariablesMsg">
           </wsdl:input>
           <wsdl:output
               message="tns:AllDigitalVariablesResponseMsg"
name="get_all_digital_variables_response">
           </wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="get_all_analogic_variables">
           <wsdl:input
               message="tns:GetAllAnalogicVariablesMsg">
           </wsdl:input>
           <wsdl:output
               message="tns:AllAnalogicVariablesResponseMsg"
name="get_all_analogic_variables_response">
           </wsdl:output>
       </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="VarsBinding" type="tns:vars">
       <soap:binding style="document"
               transport="http://schemas.xmlsoap.org/soap/http" />
       <wsdl:operation name="get_digital_variables">
               <soap:operation
                       soapAction="
http://www.example.org/rsu_vars/get_digital_variables" />
               <wsdl:input>
                       <soap:body use="literal" />
               </wsdl:input>
               <wsdl:output name="get_digital_variables_response">
                       <soap:body use="literal" />
               </wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="get_analogic_variables">
               <soap:operation
                       soapAction="
http://www.example.org/rsu_vars/get_analogic_variables" />
               <wsdl:input>
                       <soap:body use="literal" />
               </wsdl:input>
               <wsdl:output name="get_analogic_variables_response">
                       <soap:body use="literal" />
               </wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="get_all_digital_variables">
               <soap:operation
                       soapAction="
http://www.example.org/rsu_vars/get_all_digital_variables" />
               <wsdl:input>
                       <soap:body use="literal" />
               </wsdl:input>
               <wsdl:output name="get_all_digital_variables_response">
                       <soap:body use="literal" />
               </wsdl:output>
       </wsdl:operation>
       <wsdl:operation name="get_all_analogic_variables">
               <soap:operation
                       soapAction="
http://www.example.org/rsu_vars/get_all_analogic_variables" />
               <wsdl:input>
                       <soap:body use="literal" />
               </wsdl:input>
               <wsdl:output name="get_all_analogic_variables_response">
                       <soap:body use="literal" />
               </wsdl:output>
       </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="rsu_vars">
   <wsdl:port binding="tns:VarsBinding" name="vars_port">
     <soap:address location="http://www.example.org/rsu_vars/"/>
   </wsdl:port>
 </wsdl:service>
</wsdl:definitions>
--- WSDL END ---

Thanks
-- 
/****************************************************
Unai Estébanez Sevilla
mail: unai@unainet.net
web: www.unainet.net
****************************************************/

Re: Problem in deserialization with WSDL2C generated code

Posted by Dimuthu Gamage <di...@gmail.com>.
Correction: "RT_AnalogVarListSequence" is a type and there should *not* be
any xml tag in that name.

Dimuthu

On Sat, Jul 25, 2009 at 8:52 PM, Dimuthu Gamage <di...@gmail.com> wrote:

>
> Hi Unai,
>
> This is a bug in fact in the deserializaton code.
> "RT_AnalogVarListSequence" is a type and there should be any xml tag in that
> name.
> Look at the pattern on the non-array case (this bug is there with the array
> scenario), the code inside
>
>
>>
>>     if (axutil_qname_equals(element_qname, env, qname))
>>     {
>>
>>                is_early_node_valid = AXIS2_TRUE;
>
>                   ..
>
> should be changed to
>
>
>
>>
>>     if (adb_RT_AnalogVarListSequence_is_particle() ||
>> axutil_qname_equals(element_qname, env, qname))
>>     {
>>            if (axutil_qname_equals(element_qname, env, qname))
>>            {
>>                 is_early_node_valid = AXIS2_TRUE;
>>
>                }
>                ..
>
> Please raise a jira to report this problem.
>
> Thanks
> Dimuthu
>
>
> 2009/7/24 Unai Estébanez <un...@unainet.net>
>
> Hi,
>> I have a problem with my client while I try to deserialize my server
>> response. Please, could anybody help me?
>>
>> I generate the server and client code with WSDL2C
>> client: /usr/local/axis2c/bin/tools/wsdl2c/WSDL2C.sh -uri ./rsu_vars.wsdl
>> -sp -d adb -uw --noBuildXML
>> server: /usr/local/axis2c/bin/tools/wsdl2c/WSDL2C.sh -uri ./rsu_vars.wsdl
>> -ss -sd -sp -d adb -uw --noBuildXML
>>
>> At the bottom of this message I will include the wsdl I use.
>>
>> The problem I have is that when I serialize, the automatic generated code,
>> perform this check: ( I have hand written remarks inside the code )
>> --- SEVER SERIALIZATION CODE BEGIN ---
>> .... more code here
>>                     /*
>>                      * parsing RT_AnalogVarListSequence element
>>                      */
>>                            if(!adb_RT_AnalogVarListSequence_is_particle())
>> <----- THIS FUNCTIONS ALWAYS DO: "return AXIS2_TRUE;"
>>                            {
>>                                axutil_stream_write(stream, env,
>> start_input_str, start_input_str_len); <-- NEVER INSERTS THE TAG
>> "<RT_AnalogVarListSequence>"
>>                            }
>>
>>  adb_RT_AnalogVarListSequence_serialize((adb_RT_AnalogVarListSequence_t*)element,
>>
>>
>>       env, current_node, parent_element,
>>
>>       adb_RT_AnalogVarListSequence_is_particle() || AXIS2_FALSE, namespaces,
>> next_ns_index);
>>                            if(!adb_RT_AnalogVarListSequence_is_particle())
>>                            {
>>                                axutil_stream_write(stream, env,
>> end_input_str, end_input_str_len);
>>                            }
>>                         }
>> .... more code here
>> --- SEVER SERIALIZATION CODE END ---
>>
>> On the other hand the deserialization code fails because it needs the
>> <RT_AnalogVarListSequence> tag:
>> --- CLIENT DESERIALIZATION CODE BEGIN ---
>> /*
>>  * building RT_AnalogVarListSequence element
>> */
>> element_qname = axutil_qname_create(env, "RT_AnalogVarListSequence", "
>> http://www.example.org/rsu_vars/", NULL); <-- CLient expects the
>> "<RT_AnalogVarListSequence>" tag
>> for (i = 0, sequence_broken = 0, current_node = first_node;
>> !sequence_broken && current_node != NULL;)
>> {
>>                                  if(axiom_node_get_node_type(current_node,
>> env) != AXIOM_ELEMENT)
>>                                   {
>>                                      current_node
>> =axiom_node_get_next_sibling(current_node, env);
>>                                      is_early_node_valid = AXIS2_FALSE;
>>                                      continue;
>>                                   }
>>
>>                                   current_element = (axiom_element_t
>> *)axiom_node_get_data_element(current_node, env);
>>                                   qname =
>> axiom_element_get_qname(current_element, env, current_node);
>>
>>                                   if (axutil_qname_equals(element_qname,
>> env, qname))
>>                                   {
>>
>>                                       is_early_node_valid = AXIS2_TRUE;
>>
>>
>>                                           element =
>> (void*)adb_RT_AnalogVarListSequence_create(env);
>>
>>                                           status =
>> adb_RT_AnalogVarListSequence_deserialize((adb_RT_AnalogVarListSequence_t*)element,
>> env,
>>
>> &current_node, &is_early_node_valid, AXIS2_FALSE);
>>
>>                                           if(AXIS2_FAILURE ==  status)
>>                                           {
>>                                               AXIS2_LOG_ERROR(env->log,
>> AXIS2_LOG_SI, "failed in building element RT_AnalogVarListSequence ");
>>                                           }
>>                                           else
>>                                           {
>>
>> axutil_array_list_add_at(arr_list, env, i, element);
>>                                           }
>>
>>                                      if(AXIS2_FAILURE ==  status)
>>                                      {
>>                                          AXIS2_LOG_ERROR(env->log,
>> AXIS2_LOG_SI, "failed in setting the value for RT_AnalogVarListSequence ");
>>                                          if(element_qname)
>>                                          {
>>
>> axutil_qname_free(element_qname, env);
>>                                          }
>>                                          if(arr_list)
>>                                          {
>>
>> axutil_array_list_free(arr_list, env);
>>                                          }
>>                                          return AXIS2_FAILURE;
>>                                      }
>>
>>                                      i ++;
>>                                     current_node =
>> axiom_node_get_next_sibling(current_node, env);
>>                                   }
>>                                   else
>>                                   {
>>                                      ALWAYS ENTER HERE!!!!
>>                                       is_early_node_valid = AXIS2_FALSE;
>>                                       sequence_broken = 1;
>>                                   }
>>
>> }
>> --- CLIENT DESERIALIZATION CODE END ---
>>
>> --- WSDL BEGIN ---
>> <?xml version="1.0" encoding="UTF-8"?>
>> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:tns="http://www.example.org/rsu_vars/" xmlns:wsdl="
>> http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="
>> http://www.w3.org/2001/XMLSchema" name="rsu_vars" targetNamespace="
>> http://www.example.org/rsu_vars/">
>>  <wsdl:types>
>>    <xsd:schema targetNamespace="http://www.example.org/rsu_vars/">
>>
>>        <xsd:complexType name="RT_DigitalVar">
>>                <xsd:sequence>
>>                        <xsd:element name="ID_DigitalVar"
>> type="xsd:string"></xsd:element>
>>                        <xsd:element name="OwnerType"
>> type="xsd:string"></xsd:element>
>>                        <xsd:element name="OwnerCode"
>> type="xsd:int"></xsd:element>
>>                        <xsd:element name="RT_TimeStamp"
>> type="xsd:dateTime"></xsd:element>
>>                        <xsd:element name="RT_Value"
>> type="xsd:int"></xsd:element>
>>                        <xsd:element name="RT_Alm"
>> type="xsd:int"></xsd:element>
>>                </xsd:sequence>
>>        </xsd:complexType>
>>
>>        <xsd:complexType name="RT_AnalogVar">
>>                <xsd:sequence>
>>                        <xsd:element name="ID_AnalogVar"
>> type="xsd:string"></xsd:element>
>>                        <xsd:element name="OwnerType"
>> type="xsd:string"></xsd:element>
>>                        <xsd:element name="OwnerCode"
>> type="xsd:int"></xsd:element>
>>                        <xsd:element name="RT_TimeStamp"
>> type="xsd:dateTime"></xsd:element>
>>                        <xsd:element name="RT_Value"
>> type="xsd:double"></xsd:element>
>>                        <xsd:element name="RT_Alm"
>> type="xsd:int"></xsd:element>
>>                </xsd:sequence>
>>        </xsd:complexType>
>>
>>        <xsd:complexType name="ID_Variable">
>>                <xsd:sequence>
>>                        <xsd:element name="ID_Var"
>> type="xsd:string"></xsd:element>
>>                        <xsd:element name="OwnerType"
>> type="xsd:string"></xsd:element>
>>                        <xsd:element name="OwnerCode"
>> type="xsd:int"></xsd:element>
>>                </xsd:sequence>
>>        </xsd:complexType>
>>
>>        <xsd:element name="IDVariable"
>> type="tns:ID_Variable"></xsd:element>
>>
>>        <xsd:element name="AnalogicVariable"
>> type="tns:RT_AnalogVar"></xsd:element>
>>
>>        <xsd:element name="DigitalVariable"
>> type="tns:RT_DigitalVar"></xsd:element>
>>
>>        <xsd:complexType name="RT_AnalogVarList">
>>                <xsd:sequence minOccurs="1" maxOccurs="255">
>>                        <xsd:element name="NewElement"
>>                                type="tns:RT_AnalogVar">
>>                        </xsd:element>
>>                </xsd:sequence>
>>        </xsd:complexType>
>>
>>        <xsd:complexType name="RT_DigitalVarList">
>>                <xsd:sequence minOccurs="1" maxOccurs="255">
>>                        <xsd:element name="NewElement"
>>                                type="tns:RT_DigitalVar">
>>                        </xsd:element>
>>                </xsd:sequence>
>>        </xsd:complexType>
>>
>>        <xsd:element name="AnalogicVariableList"
>>                type="tns:RT_AnalogVarList">
>>        </xsd:element>
>>
>>        <xsd:element name="DigitalVariableList"
>>                type="tns:RT_DigitalVarList">
>>        </xsd:element>
>>        <xsd:element name="get_all_digital_variables">
>>                <xsd:complexType>
>>                        <xsd:sequence>
>>                                <xsd:element name="in"
>> type="xsd:string"></xsd:element>
>>                        </xsd:sequence>
>>                </xsd:complexType>
>>        </xsd:element>
>>        <xsd:element name="get_all_digital_variablesResponse">
>>                <xsd:complexType>
>>                        <xsd:sequence>
>>                                <xsd:element name="out"
>> type="xsd:string"></xsd:element>
>>                        </xsd:sequence>
>>                </xsd:complexType>
>>        </xsd:element>
>>        <xsd:element name="get_all_analogic_variables">
>>                <xsd:complexType>
>>                        <xsd:sequence>
>>                                <xsd:element name="in"
>> type="xsd:string"></xsd:element>
>>                        </xsd:sequence>
>>                </xsd:complexType>
>>        </xsd:element>
>>        <xsd:element name="get_all_analogic_variablesResponse">
>>                <xsd:complexType>
>>                        <xsd:sequence>
>>                                <xsd:element name="out"
>> type="xsd:string"></xsd:element>
>>                        </xsd:sequence>
>>                </xsd:complexType>
>>        </xsd:element>
>>    </xsd:schema>
>>  </wsdl:types>
>>    <wsdl:message name="GetDigitalVariableMsg">
>>        <wsdl:part name="Parameter"
>> element="tns:IDVariable"></wsdl:part></wsdl:message>
>>    <wsdl:message name="DigitalVariableResponseMsg">
>>        <wsdl:part name="Parameter"
>> element="tns:DigitalVariable"></wsdl:part></wsdl:message>
>>    <wsdl:message name="GetAnalogVariableMsg">
>>        <wsdl:part name="Parameter"
>> element="tns:IDVariable"></wsdl:part></wsdl:message>
>>    <wsdl:message name="AnalogVariableResponseMsg">
>>        <wsdl:part name="Parameter"
>> element="tns:AnalogicVariable"></wsdl:part></wsdl:message>
>>    <wsdl:message name="GetAllDigitalVariablesMsg">
>>    </wsdl:message>
>>    <wsdl:message name="AllDigitalVariablesResponseMsg">
>>        <wsdl:part name="parameters"
>> element="tns:DigitalVariableList"></wsdl:part>
>>    </wsdl:message>
>>    <wsdl:message name="GetAllAnalogicVariablesMsg">
>>    </wsdl:message>
>>    <wsdl:message name="AllAnalogicVariablesResponseMsg">
>>        <wsdl:part name="parameters"
>> element="tns:AnalogicVariableList"></wsdl:part>
>>    </wsdl:message>
>>    <wsdl:portType name="vars">
>>        <wsdl:operation name="get_digital_variables">
>>                <wsdl:input
>> message="tns:GetDigitalVariableMsg"></wsdl:input>
>>                <wsdl:output message="tns:DigitalVariableResponseMsg"
>> name="get_digital_variables_response"></wsdl:output>
>>        </wsdl:operation>
>>        <wsdl:operation name="get_analogic_variables">
>>                <wsdl:input
>> message="tns:GetAnalogVariableMsg"></wsdl:input>
>>                <wsdl:output message="tns:AnalogVariableResponseMsg"
>> name="get_analogic_variables_response"></wsdl:output>
>>        </wsdl:operation>
>>        <wsdl:operation name="get_all_digital_variables">
>>            <wsdl:input
>>                message="tns:GetAllDigitalVariablesMsg">
>>            </wsdl:input>
>>            <wsdl:output
>>                message="tns:AllDigitalVariablesResponseMsg"
>> name="get_all_digital_variables_response">
>>            </wsdl:output>
>>        </wsdl:operation>
>>        <wsdl:operation name="get_all_analogic_variables">
>>            <wsdl:input
>>                message="tns:GetAllAnalogicVariablesMsg">
>>            </wsdl:input>
>>            <wsdl:output
>>                message="tns:AllAnalogicVariablesResponseMsg"
>> name="get_all_analogic_variables_response">
>>            </wsdl:output>
>>        </wsdl:operation>
>>    </wsdl:portType>
>>    <wsdl:binding name="VarsBinding" type="tns:vars">
>>        <soap:binding style="document"
>>                transport="http://schemas.xmlsoap.org/soap/http" />
>>        <wsdl:operation name="get_digital_variables">
>>                <soap:operation
>>                        soapAction="
>> http://www.example.org/rsu_vars/get_digital_variables" />
>>                <wsdl:input>
>>                        <soap:body use="literal" />
>>                </wsdl:input>
>>                <wsdl:output name="get_digital_variables_response">
>>                        <soap:body use="literal" />
>>                </wsdl:output>
>>        </wsdl:operation>
>>        <wsdl:operation name="get_analogic_variables">
>>                <soap:operation
>>                        soapAction="
>> http://www.example.org/rsu_vars/get_analogic_variables" />
>>                <wsdl:input>
>>                        <soap:body use="literal" />
>>                </wsdl:input>
>>                <wsdl:output name="get_analogic_variables_response">
>>                        <soap:body use="literal" />
>>                </wsdl:output>
>>        </wsdl:operation>
>>        <wsdl:operation name="get_all_digital_variables">
>>                <soap:operation
>>                        soapAction="
>> http://www.example.org/rsu_vars/get_all_digital_variables" />
>>                <wsdl:input>
>>                        <soap:body use="literal" />
>>                </wsdl:input>
>>                <wsdl:output name="get_all_digital_variables_response">
>>                        <soap:body use="literal" />
>>                </wsdl:output>
>>        </wsdl:operation>
>>        <wsdl:operation name="get_all_analogic_variables">
>>                <soap:operation
>>                        soapAction="
>> http://www.example.org/rsu_vars/get_all_analogic_variables" />
>>                <wsdl:input>
>>                        <soap:body use="literal" />
>>                </wsdl:input>
>>                <wsdl:output name="get_all_analogic_variables_response">
>>                        <soap:body use="literal" />
>>                </wsdl:output>
>>        </wsdl:operation>
>>    </wsdl:binding>
>>    <wsdl:service name="rsu_vars">
>>    <wsdl:port binding="tns:VarsBinding" name="vars_port">
>>      <soap:address location="http://www.example.org/rsu_vars/"/>
>>    </wsdl:port>
>>  </wsdl:service>
>> </wsdl:definitions>
>> --- WSDL END ---
>>
>> Thanks
>> --
>> /****************************************************
>> Unai Estébanez Sevilla
>> mail: unai@unainet.net
>> web: www.unainet.net
>> ****************************************************/
>>
>>
>>
>
>
> --
> Thanks,
> Dimuthu Gamage
>
> http://www.dimuthu.org
> http://www.wso2.org
>



-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org

Re: Problem in deserialization with WSDL2C generated code

Posted by Dimuthu Gamage <di...@gmail.com>.
Hi Unai,

This is a bug in fact in the deserializaton code. "RT_AnalogVarListSequence"
is a type and there should be any xml tag in that name.
Look at the pattern on the non-array case (this bug is there with the array
scenario), the code inside


>
>     if (axutil_qname_equals(element_qname, env, qname))
>     {
>
>                is_early_node_valid = AXIS2_TRUE;

                  ..

should be changed to



>
>     if (adb_RT_AnalogVarListSequence_is_particle() ||
> axutil_qname_equals(element_qname, env, qname))
>     {
>            if (axutil_qname_equals(element_qname, env, qname))
>            {
>                 is_early_node_valid = AXIS2_TRUE;
>
               }
               ..

Please raise a jira to report this problem.

Thanks
Dimuthu


2009/7/24 Unai Estébanez <un...@unainet.net>

> Hi,
> I have a problem with my client while I try to deserialize my server
> response. Please, could anybody help me?
>
> I generate the server and client code with WSDL2C
> client: /usr/local/axis2c/bin/tools/wsdl2c/WSDL2C.sh -uri ./rsu_vars.wsdl
> -sp -d adb -uw --noBuildXML
> server: /usr/local/axis2c/bin/tools/wsdl2c/WSDL2C.sh -uri ./rsu_vars.wsdl
> -ss -sd -sp -d adb -uw --noBuildXML
>
> At the bottom of this message I will include the wsdl I use.
>
> The problem I have is that when I serialize, the automatic generated code,
> perform this check: ( I have hand written remarks inside the code )
> --- SEVER SERIALIZATION CODE BEGIN ---
> .... more code here
>                     /*
>                      * parsing RT_AnalogVarListSequence element
>                      */
>                            if(!adb_RT_AnalogVarListSequence_is_particle())
> <----- THIS FUNCTIONS ALWAYS DO: "return AXIS2_TRUE;"
>                            {
>                                axutil_stream_write(stream, env,
> start_input_str, start_input_str_len); <-- NEVER INSERTS THE TAG
> "<RT_AnalogVarListSequence>"
>                            }
>
>  adb_RT_AnalogVarListSequence_serialize((adb_RT_AnalogVarListSequence_t*)element,
>
>
>     env, current_node, parent_element,
>
>     adb_RT_AnalogVarListSequence_is_particle() || AXIS2_FALSE, namespaces,
> next_ns_index);
>                            if(!adb_RT_AnalogVarListSequence_is_particle())
>                            {
>                                axutil_stream_write(stream, env,
> end_input_str, end_input_str_len);
>                            }
>                         }
> .... more code here
> --- SEVER SERIALIZATION CODE END ---
>
> On the other hand the deserialization code fails because it needs the
> <RT_AnalogVarListSequence> tag:
> --- CLIENT DESERIALIZATION CODE BEGIN ---
> /*
>  * building RT_AnalogVarListSequence element
> */
> element_qname = axutil_qname_create(env, "RT_AnalogVarListSequence", "
> http://www.example.org/rsu_vars/", NULL); <-- CLient expects the
> "<RT_AnalogVarListSequence>" tag
> for (i = 0, sequence_broken = 0, current_node = first_node;
> !sequence_broken && current_node != NULL;)
> {
>                                  if(axiom_node_get_node_type(current_node,
> env) != AXIOM_ELEMENT)
>                                   {
>                                      current_node
> =axiom_node_get_next_sibling(current_node, env);
>                                      is_early_node_valid = AXIS2_FALSE;
>                                      continue;
>                                   }
>
>                                   current_element = (axiom_element_t
> *)axiom_node_get_data_element(current_node, env);
>                                   qname =
> axiom_element_get_qname(current_element, env, current_node);
>
>                                   if (axutil_qname_equals(element_qname,
> env, qname))
>                                   {
>
>                                       is_early_node_valid = AXIS2_TRUE;
>
>
>                                           element =
> (void*)adb_RT_AnalogVarListSequence_create(env);
>
>                                           status =
> adb_RT_AnalogVarListSequence_deserialize((adb_RT_AnalogVarListSequence_t*)element,
> env,
>
> &current_node, &is_early_node_valid, AXIS2_FALSE);
>
>                                           if(AXIS2_FAILURE ==  status)
>                                           {
>                                               AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI, "failed in building element RT_AnalogVarListSequence ");
>                                           }
>                                           else
>                                           {
>
> axutil_array_list_add_at(arr_list, env, i, element);
>                                           }
>
>                                      if(AXIS2_FAILURE ==  status)
>                                      {
>                                          AXIS2_LOG_ERROR(env->log,
> AXIS2_LOG_SI, "failed in setting the value for RT_AnalogVarListSequence ");
>                                          if(element_qname)
>                                          {
>
> axutil_qname_free(element_qname, env);
>                                          }
>                                          if(arr_list)
>                                          {
>
> axutil_array_list_free(arr_list, env);
>                                          }
>                                          return AXIS2_FAILURE;
>                                      }
>
>                                      i ++;
>                                     current_node =
> axiom_node_get_next_sibling(current_node, env);
>                                   }
>                                   else
>                                   {
>                                      ALWAYS ENTER HERE!!!!
>                                       is_early_node_valid = AXIS2_FALSE;
>                                       sequence_broken = 1;
>                                   }
>
> }
> --- CLIENT DESERIALIZATION CODE END ---
>
> --- WSDL BEGIN ---
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://www.example.org/rsu_vars/" xmlns:wsdl="
> http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="
> http://www.w3.org/2001/XMLSchema" name="rsu_vars" targetNamespace="
> http://www.example.org/rsu_vars/">
>  <wsdl:types>
>    <xsd:schema targetNamespace="http://www.example.org/rsu_vars/">
>
>        <xsd:complexType name="RT_DigitalVar">
>                <xsd:sequence>
>                        <xsd:element name="ID_DigitalVar"
> type="xsd:string"></xsd:element>
>                        <xsd:element name="OwnerType"
> type="xsd:string"></xsd:element>
>                        <xsd:element name="OwnerCode"
> type="xsd:int"></xsd:element>
>                        <xsd:element name="RT_TimeStamp"
> type="xsd:dateTime"></xsd:element>
>                        <xsd:element name="RT_Value"
> type="xsd:int"></xsd:element>
>                        <xsd:element name="RT_Alm"
> type="xsd:int"></xsd:element>
>                </xsd:sequence>
>        </xsd:complexType>
>
>        <xsd:complexType name="RT_AnalogVar">
>                <xsd:sequence>
>                        <xsd:element name="ID_AnalogVar"
> type="xsd:string"></xsd:element>
>                        <xsd:element name="OwnerType"
> type="xsd:string"></xsd:element>
>                        <xsd:element name="OwnerCode"
> type="xsd:int"></xsd:element>
>                        <xsd:element name="RT_TimeStamp"
> type="xsd:dateTime"></xsd:element>
>                        <xsd:element name="RT_Value"
> type="xsd:double"></xsd:element>
>                        <xsd:element name="RT_Alm"
> type="xsd:int"></xsd:element>
>                </xsd:sequence>
>        </xsd:complexType>
>
>        <xsd:complexType name="ID_Variable">
>                <xsd:sequence>
>                        <xsd:element name="ID_Var"
> type="xsd:string"></xsd:element>
>                        <xsd:element name="OwnerType"
> type="xsd:string"></xsd:element>
>                        <xsd:element name="OwnerCode"
> type="xsd:int"></xsd:element>
>                </xsd:sequence>
>        </xsd:complexType>
>
>        <xsd:element name="IDVariable" type="tns:ID_Variable"></xsd:element>
>
>        <xsd:element name="AnalogicVariable"
> type="tns:RT_AnalogVar"></xsd:element>
>
>        <xsd:element name="DigitalVariable"
> type="tns:RT_DigitalVar"></xsd:element>
>
>        <xsd:complexType name="RT_AnalogVarList">
>                <xsd:sequence minOccurs="1" maxOccurs="255">
>                        <xsd:element name="NewElement"
>                                type="tns:RT_AnalogVar">
>                        </xsd:element>
>                </xsd:sequence>
>        </xsd:complexType>
>
>        <xsd:complexType name="RT_DigitalVarList">
>                <xsd:sequence minOccurs="1" maxOccurs="255">
>                        <xsd:element name="NewElement"
>                                type="tns:RT_DigitalVar">
>                        </xsd:element>
>                </xsd:sequence>
>        </xsd:complexType>
>
>        <xsd:element name="AnalogicVariableList"
>                type="tns:RT_AnalogVarList">
>        </xsd:element>
>
>        <xsd:element name="DigitalVariableList"
>                type="tns:RT_DigitalVarList">
>        </xsd:element>
>        <xsd:element name="get_all_digital_variables">
>                <xsd:complexType>
>                        <xsd:sequence>
>                                <xsd:element name="in"
> type="xsd:string"></xsd:element>
>                        </xsd:sequence>
>                </xsd:complexType>
>        </xsd:element>
>        <xsd:element name="get_all_digital_variablesResponse">
>                <xsd:complexType>
>                        <xsd:sequence>
>                                <xsd:element name="out"
> type="xsd:string"></xsd:element>
>                        </xsd:sequence>
>                </xsd:complexType>
>        </xsd:element>
>        <xsd:element name="get_all_analogic_variables">
>                <xsd:complexType>
>                        <xsd:sequence>
>                                <xsd:element name="in"
> type="xsd:string"></xsd:element>
>                        </xsd:sequence>
>                </xsd:complexType>
>        </xsd:element>
>        <xsd:element name="get_all_analogic_variablesResponse">
>                <xsd:complexType>
>                        <xsd:sequence>
>                                <xsd:element name="out"
> type="xsd:string"></xsd:element>
>                        </xsd:sequence>
>                </xsd:complexType>
>        </xsd:element>
>    </xsd:schema>
>  </wsdl:types>
>    <wsdl:message name="GetDigitalVariableMsg">
>        <wsdl:part name="Parameter"
> element="tns:IDVariable"></wsdl:part></wsdl:message>
>    <wsdl:message name="DigitalVariableResponseMsg">
>        <wsdl:part name="Parameter"
> element="tns:DigitalVariable"></wsdl:part></wsdl:message>
>    <wsdl:message name="GetAnalogVariableMsg">
>        <wsdl:part name="Parameter"
> element="tns:IDVariable"></wsdl:part></wsdl:message>
>    <wsdl:message name="AnalogVariableResponseMsg">
>        <wsdl:part name="Parameter"
> element="tns:AnalogicVariable"></wsdl:part></wsdl:message>
>    <wsdl:message name="GetAllDigitalVariablesMsg">
>    </wsdl:message>
>    <wsdl:message name="AllDigitalVariablesResponseMsg">
>        <wsdl:part name="parameters"
> element="tns:DigitalVariableList"></wsdl:part>
>    </wsdl:message>
>    <wsdl:message name="GetAllAnalogicVariablesMsg">
>    </wsdl:message>
>    <wsdl:message name="AllAnalogicVariablesResponseMsg">
>        <wsdl:part name="parameters"
> element="tns:AnalogicVariableList"></wsdl:part>
>    </wsdl:message>
>    <wsdl:portType name="vars">
>        <wsdl:operation name="get_digital_variables">
>                <wsdl:input
> message="tns:GetDigitalVariableMsg"></wsdl:input>
>                <wsdl:output message="tns:DigitalVariableResponseMsg"
> name="get_digital_variables_response"></wsdl:output>
>        </wsdl:operation>
>        <wsdl:operation name="get_analogic_variables">
>                <wsdl:input message="tns:GetAnalogVariableMsg"></wsdl:input>
>                <wsdl:output message="tns:AnalogVariableResponseMsg"
> name="get_analogic_variables_response"></wsdl:output>
>        </wsdl:operation>
>        <wsdl:operation name="get_all_digital_variables">
>            <wsdl:input
>                message="tns:GetAllDigitalVariablesMsg">
>            </wsdl:input>
>            <wsdl:output
>                message="tns:AllDigitalVariablesResponseMsg"
> name="get_all_digital_variables_response">
>            </wsdl:output>
>        </wsdl:operation>
>        <wsdl:operation name="get_all_analogic_variables">
>            <wsdl:input
>                message="tns:GetAllAnalogicVariablesMsg">
>            </wsdl:input>
>            <wsdl:output
>                message="tns:AllAnalogicVariablesResponseMsg"
> name="get_all_analogic_variables_response">
>            </wsdl:output>
>        </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="VarsBinding" type="tns:vars">
>        <soap:binding style="document"
>                transport="http://schemas.xmlsoap.org/soap/http" />
>        <wsdl:operation name="get_digital_variables">
>                <soap:operation
>                        soapAction="
> http://www.example.org/rsu_vars/get_digital_variables" />
>                <wsdl:input>
>                        <soap:body use="literal" />
>                </wsdl:input>
>                <wsdl:output name="get_digital_variables_response">
>                        <soap:body use="literal" />
>                </wsdl:output>
>        </wsdl:operation>
>        <wsdl:operation name="get_analogic_variables">
>                <soap:operation
>                        soapAction="
> http://www.example.org/rsu_vars/get_analogic_variables" />
>                <wsdl:input>
>                        <soap:body use="literal" />
>                </wsdl:input>
>                <wsdl:output name="get_analogic_variables_response">
>                        <soap:body use="literal" />
>                </wsdl:output>
>        </wsdl:operation>
>        <wsdl:operation name="get_all_digital_variables">
>                <soap:operation
>                        soapAction="
> http://www.example.org/rsu_vars/get_all_digital_variables" />
>                <wsdl:input>
>                        <soap:body use="literal" />
>                </wsdl:input>
>                <wsdl:output name="get_all_digital_variables_response">
>                        <soap:body use="literal" />
>                </wsdl:output>
>        </wsdl:operation>
>        <wsdl:operation name="get_all_analogic_variables">
>                <soap:operation
>                        soapAction="
> http://www.example.org/rsu_vars/get_all_analogic_variables" />
>                <wsdl:input>
>                        <soap:body use="literal" />
>                </wsdl:input>
>                <wsdl:output name="get_all_analogic_variables_response">
>                        <soap:body use="literal" />
>                </wsdl:output>
>        </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="rsu_vars">
>    <wsdl:port binding="tns:VarsBinding" name="vars_port">
>      <soap:address location="http://www.example.org/rsu_vars/"/>
>    </wsdl:port>
>  </wsdl:service>
> </wsdl:definitions>
> --- WSDL END ---
>
> Thanks
> --
> /****************************************************
> Unai Estébanez Sevilla
> mail: unai@unainet.net
> web: www.unainet.net
> ****************************************************/
>
>
>


-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org