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 Atanacio Reyes <ar...@yahoo.com> on 2006/05/10 23:52:24 UTC

Deserialize complex arrays

Hi.

I'm using axis-c-1.6B to build a web service. The
client side send the next soap message:

POST /axis/Calcot HTTP/1.1
Host: areyes:80
Content-Type: text/xml; charset=UTF-8
SOAPAction: "Calcot#contorno"
Content-Length: 1414


<?xml version='1.0' encoding='utf-8' ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<SOAP-ENV:Body>
<ns1:contorno xmlns:ns1="http://areyes/axis/Calcot">
<ParamArm xsi:type="ns2:ParamArm"
xmlns:ns2="http://areyes/axis/Calcot/xsd">
<Caja xsi:type="ns2:Caja">
 <aro xsi:type="xsd:float">40</aro>
 <vertical xsi:type="xsd:float">40</vertical>
 <diagonal xsi:type="xsd:float">40</diagonal>
</Caja>
<ns2:forLadoArray xmlns:ns2=""
xmlns:enc="http://www.w3.org/2001/06/soap-encoding"
xmlns:ns2="http://areyes/axis/Calcot/xsd"
enc:arrayType="ns2:forLado[2]">
 <ParamForma>
  <lado xsi:type="xsd:byte">68</lado>
  <codigob xsi:type="xsd:string">2105001131</codigob>
  <dpMono xsi:type="xsd:float">31</dpMono>
  <difDP xsi:type="xsd:float">1</difDP>
  <Potencia xsi:type="ns2:Potencia">
   <esf xsi:type="xsd:float">0</esf>
   <eje xsi:type="xsd:int">15</eje>
  </Potencia>
 </ParamForma>
 <ParamForma>
  <lado xsi:type="xsd:byte">73</lado>
  <codigob xsi:type="xsd:string">2105001164</codigob>
  <dpMono xsi:type="xsd:float">31</dpMono>
  <difDP xsi:type="xsd:float">1</difDP>
  <Potencia xsi:type="ns2:Potencia">
   <esf xsi:type="xsd:float">0</esf>
   <eje xsi:type="xsd:int">165</eje>
  </Potencia>
 </ParamForma>
</ns2:forLadoArray>
<puente xsi:type="xsd:float">15</puente>
</ParamArm>
</ns1:contorno>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

in order to deserialize the message the server execute
this function:

int Axis_DeSerialize_ParamArm(ParamArm* param,
IWrapperSoapDeSerializer* pIWSDZ)
{
  param->mman =
(Caja*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_Caja,
 (void*)Axis_Create_Caja,(void*)Axis_Delete_Caja,
"mman", Axis_URI_Type);

  ParamForma_Array * array0 = new ParamForma_Array();

  array0 = (ParamForma_Array *)
pIWSDZ->getCmplxArray(array0,
  (void*)Axis_DeSerialize_ParamForma,
  (void*)Axis_Create_ParamForma,
  (void*)Axis_Delete_ParamForma,
  (void*)Axis_GetSize_ParamForma,
  "forLado",Axis_URI_Type);

  param->forLado = array0;

  int size
  ParamForma** tmp = param->forLado->get(size);

  xsd__float* p_puente =
(pIWSDZ->getElementAsFloat("puente",0));
  if(p_puente) param->puente = *p_puente;
  delete p_puente;

  return pIWSDZ->getStatus();
}

the function getCmplxObject() is ok, but the function
param->forLado->get(size), in the size parameter
return 0, the functions:

(void*)Axis_DeSerialize_ParamForma,
(void*)Axis_Create_ParamForma,
(void*)Axis_Delete_ParamForma,
are not executed. the function getCmplxArray is not
deserializing the forLadoArray.

the server stop with segmentation fault, executing the
function getElementAsFloat("puente",0));

What is wrong in the getCmplxArray() function?,
Arguments?, or What is wrong in the soap message?

any help is welcome.

Atanacio Reyes.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Deserialize complex arrays

Posted by Atanacio Reyes <ar...@yahoo.com>.

--- Atanacio Reyes <ar...@yahoo.com> wrote:

> Hi.
> 
> I'm using axis-c-1.6B to build a web service. The
> client side send the next soap message:
> 
> POST /axis/Calcot HTTP/1.1
> Host: areyes:80
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: "Calcot#contorno"
> Content-Length: 1414
> 
> 
> <?xml version='1.0' encoding='utf-8' ?>
> <SOAP-ENV:Envelope
>
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
> <SOAP-ENV:Body>
> <ns1:contorno xmlns:ns1="http://areyes/axis/Calcot">
> <ParamArm xsi:type="ns2:ParamArm"
> xmlns:ns2="http://areyes/axis/Calcot/xsd">
> <Caja xsi:type="ns2:Caja">
>  <aro xsi:type="xsd:float">40</aro>
>  <vertical xsi:type="xsd:float">40</vertical>
>  <diagonal xsi:type="xsd:float">40</diagonal>
> </Caja>
> <ns2:forLadoArray xmlns:ns2=""
> xmlns:enc="http://www.w3.org/2001/06/soap-encoding"
> xmlns:ns2="http://areyes/axis/Calcot/xsd"
> enc:arrayType="ns2:forLado[2]">
>  <ParamForma>
>   <lado xsi:type="xsd:byte">68</lado>
>   <codigob
> xsi:type="xsd:string">2105001131</codigob>
>   <dpMono xsi:type="xsd:float">31</dpMono>
>   <difDP xsi:type="xsd:float">1</difDP>
>   <Potencia xsi:type="ns2:Potencia">
>    <esf xsi:type="xsd:float">0</esf>
>    <eje xsi:type="xsd:int">15</eje>
>   </Potencia>
>  </ParamForma>
>  <ParamForma>
>   <lado xsi:type="xsd:byte">73</lado>
>   <codigob
> xsi:type="xsd:string">2105001164</codigob>
>   <dpMono xsi:type="xsd:float">31</dpMono>
>   <difDP xsi:type="xsd:float">1</difDP>
>   <Potencia xsi:type="ns2:Potencia">
>    <esf xsi:type="xsd:float">0</esf>
>    <eje xsi:type="xsd:int">165</eje>
>   </Potencia>
>  </ParamForma>
> </ns2:forLadoArray>
> <puente xsi:type="xsd:float">15</puente>
> </ParamArm>
> </ns1:contorno>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> in order to deserialize the message the server
> execute
> this function:
> 
> int Axis_DeSerialize_ParamArm(ParamArm* param,
> IWrapperSoapDeSerializer* pIWSDZ)
> {
>   param->mman =
>
(Caja*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_Caja,
>  (void*)Axis_Create_Caja,(void*)Axis_Delete_Caja,
> "mman", Axis_URI_Type);
> 
>   ParamForma_Array * array0 = new
> ParamForma_Array();
> 
>   array0 = (ParamForma_Array *)
> pIWSDZ->getCmplxArray(array0,
>   (void*)Axis_DeSerialize_ParamForma,
>   (void*)Axis_Create_ParamForma,
>   (void*)Axis_Delete_ParamForma,
>   (void*)Axis_GetSize_ParamForma,
>   "forLado",Axis_URI_Type);
> 
>   param->forLado = array0;
> 
>   int size
>   ParamForma** tmp = param->forLado->get(size);
> 
>   xsd__float* p_puente =
> (pIWSDZ->getElementAsFloat("puente",0));
>   if(p_puente) param->puente = *p_puente;
>   delete p_puente;
> 
>   return pIWSDZ->getStatus();
> }
> 
> the function getCmplxObject() is ok, but the
> function
> param->forLado->get(size), in the size parameter
> return 0, the functions:
> 
> (void*)Axis_DeSerialize_ParamForma,
> (void*)Axis_Create_ParamForma,
> (void*)Axis_Delete_ParamForma,
> are not executed. the function getCmplxArray is not
> deserializing the forLadoArray.
> 
> the server stop with segmentation fault, executing
> the
> function getElementAsFloat("puente",0));
> 
> What is wrong in the getCmplxArray() function?,
> Arguments?, or What is wrong in the soap message?
> 
> any help is welcome.
> 
> Atanacio Reyes.
> 

I Found the error:  the error is in the soap message,
the tag:

<ns2:forLadoArray xmlns:ns2=""
 xmlns:enc="http://www.w3.org/2001/06/soap-encoding"
 xmlns:ns2="http://areyes/axis/Calcot/xsd"
 enc:arrayType="ns2:forLado[2]">

should be:

<ns2:forLadoArray
 xmlns:enc="http://www.w3.org/2001/06/soap-encoding"
 xmlns:ns2="http://areyes/axis/Calcot/xsd"
 enc:arrayType="ns2:forLado[2]">

Someone Known how to clear the xmlns:ns2="" generated
by the function:
serializeCmplxArray();

thanks for your help.

Atanacio Reyes.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com