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 Tim Bartley <tb...@au1.ibm.com> on 2005/02/09 06:24:15 UTC

Array serialization?

I am an Axis C++ newbie so please bare with me ...

I am having trouble with serialization of an array parameter on the client 
side.

The array is of a complex type.

The generated stubs create:

typedef struct Complex {
        xsd__string value1;
        xsd__string value2;
        xsd__string value3;
        xsd__int value4;
        Complex();
        ~Complex();
};

typedef struct Complex_ArrayTag {
        Complex** m_Array;
        int m_Size;
};

I can't find any Axis C++ samples using arrays of complex types.

I have code similar to the following to initialize the array.

Complex* data = new Complex[size];

<initialize data elements>

Complex_Array array;
array.m_Array = new Complex*[size];
array.m_Size = size;
for (int i = 0; i < size; ++i) {
        array.m_Array[i] = &data[i];
}

when I step through the generated Axis_Serialize_Complex function the 
"Complex* param" parameter appears to really be a "Complex** param". This 
results in horrible binary data being included in the request which is 
then generally rejected by the server.

Am I setting up my Complex_Array incorrectly or is this a bug? I'm using 
the 1.4 stable release on Linux and have just tried this with the new 1.5 
alpha with the same result.

Regarsd,

Tim Bartley
--
IBM Tivoli Access Manager Development
Gold Coast Development Lab, Australia
+61-7-5552-4001 phone
+61-7-5571-0420 fax

Complex array testing [was: Re: Array serialization?]

Posted by Samisa Abeysinghe <sa...@gmail.com>.
Do we have a test case to test complex arrays in the test suite?

I had a look and could not find any :(

Samisa...


On Wed, 9 Feb 2005 15:24:15 +1000, Tim Bartley <tb...@au1.ibm.com> wrote:
>  
> I am an Axis C++ newbie so please bare with me ... 
>  
> I am having trouble with serialization of an array parameter on the client
> side. 
>  
> The array is of a complex type. 
>  
> The generated stubs create: 
>  
> typedef struct Complex { 
>         xsd__string value1; 
>         xsd__string value2; 
>         xsd__string value3; 
>         xsd__int value4; 
>         Complex(); 
>         ~Complex(); 
> }; 
>  
> typedef struct Complex_ArrayTag { 
>         Complex** m_Array; 
>         int m_Size; 
> }; 
>  
> I can't find any Axis C++ samples using arrays of complex types. 
>  
> I have code similar to the following to initialize the array. 
>  
> Complex* data = new Complex[size]; 
>  
> <initialize data elements> 
>  
> Complex_Array array; 
> array.m_Array = new Complex*[size]; 
> array.m_Size = size; 
> for (int i = 0; i < size; ++i) { 
>         array.m_Array[i] = &data[i]; 
> } 
>  
> when I step through the generated Axis_Serialize_Complex function the
> "Complex* param" parameter appears to really be a "Complex** param". This
> results in horrible binary data being included in the request which is then
> generally rejected by the server. 
>  
> Am I setting up my Complex_Array incorrectly or is this a bug? I'm using the
> 1.4 stable release on Linux and have just tried this with the new 1.5 alpha
> with the same result. 
>  
> Regarsd, 
>  
> Tim Bartley 
> --
>  IBM Tivoli Access Manager Development
>  Gold Coast Development Lab, Australia
>  +61-7-5552-4001 phone
>  +61-7-5571-0420 fax

Re: Array serialization?

Posted by Samisa Abeysinghe <sa...@gmail.com>.
> Do I assume we need a complex class copy constructor creating then i.e. new
> JIRA ? 

If client application code need to assign or clone complex objects, we
may need them.

Going by the C++ principles, I think that is the correct thing to do.
Else, as we have seen in this case, client application code will have
problems if it is not written in the expected manner. I guess it is
too restrictive to have limits on how to write the client code. If we
have copy construcrtors, we may not have such restrictions.

Thanks,
Samisa...

Re: Array serialization?

Posted by John Hawkins <HA...@uk.ibm.com>.
Do I assume we need a complex class copy constructor creating then i.e. 
new JIRA ?





Tim Bartley <tb...@au1.ibm.com> 
10/02/2005 01:09
Please respond to
"Apache AXIS C User List"


To
"Apache AXIS C User List" <ax...@ws.apache.org>
cc

Subject
Re: Array serialization?







Thanks Samisa, 

Yes - this works around the problem. 

Thanks again. I now have a complex array deserialization issue. I'll post 
that in a separate thread. 

Tim
--
IBM Tivoli Access Manager Development
Gold Coast Development Lab, Australia
+61-7-5552-4001 phone
+61-7-5571-0420 fax 

Samisa Abeysinghe <sa...@gmail.com> wrote on 09/02/2005 
17:27:58:

> I have the gut feel that this happens due to the fact that Complex
> class do not have a copy constructor.
> 
> To verify this, can you please change your code to the following and
> test again please:
> 
>  Complex* data = new Complex[size]; 
> 
>  <initialize data elements> 
> 
>  Complex_Array array; 
>  array.m_Array = data;
>  array.m_Size = size; 
> 
> Thanks,
> Samisa...
> 
> On Wed, 9 Feb 2005 15:24:15 +1000, Tim Bartley <tb...@au1.ibm.com> 
wrote:
> > 
> > I am an Axis C++ newbie so please bare with me ... 
> > 
> > I am having trouble with serialization of an array parameter on the 
client
> > side. 
> > 
> > The array is of a complex type. 
> > 
> > The generated stubs create: 
> > 
> > typedef struct Complex { 
> >         xsd__string value1; 
> >         xsd__string value2; 
> >         xsd__string value3; 
> >         xsd__int value4; 
> >         Complex(); 
> >         ~Complex(); 
> > }; 
> > 
> > typedef struct Complex_ArrayTag { 
> >         Complex** m_Array; 
> >         int m_Size; 
> > }; 
> > 
> > I can't find any Axis C++ samples using arrays of complex types. 
> > 
> > I have code similar to the following to initialize the array. 
> > 
> > Complex* data = new Complex[size]; 
> > 
> > <initialize data elements> 
> > 
> > Complex_Array array; 
> > array.m_Array = new Complex*[size]; 
> > array.m_Size = size; 
> > for (int i = 0; i < size; ++i) { 
> >         array.m_Array[i] = &data[i]; 
> > } 
> > 
> > when I step through the generated Axis_Serialize_Complex function the
> > "Complex* param" parameter appears to really be a "Complex** param". 
This
> > results in horrible binary data being included in the request which is 
then
> > generally rejected by the server. 
> > 
> > Am I setting up my Complex_Array incorrectly or is this a bug? 
I'musing the
> > 1.4 stable release on Linux and have just tried this with the new 1.5 
alpha
> > with the same result. 
> > 
> > Regarsd, 
> > 
> > Tim Bartley 
> > --
> >  IBM Tivoli Access Manager Development
> >  Gold Coast Development Lab, Australia
> >  +61-7-5552-4001 phone
> >  +61-7-5571-0420 fax

Re: Array serialization?

Posted by Tim Bartley <tb...@au1.ibm.com>.
Thanks Samisa,

Yes - this works around the problem.

Thanks again. I now have a complex array deserialization issue. I'll post 
that in a separate thread.

Tim
--
IBM Tivoli Access Manager Development
Gold Coast Development Lab, Australia
+61-7-5552-4001 phone
+61-7-5571-0420 fax

Samisa Abeysinghe <sa...@gmail.com> wrote on 09/02/2005 
17:27:58:

> I have the gut feel that this happens due to the fact that Complex
> class do not have a copy constructor.
> 
> To verify this, can you please change your code to the following and
> test again please:
> 
>  Complex* data = new Complex[size]; 
> 
>  <initialize data elements> 
> 
>  Complex_Array array; 
>  array.m_Array = data;
>  array.m_Size = size; 
> 
> Thanks,
> Samisa...
> 
> On Wed, 9 Feb 2005 15:24:15 +1000, Tim Bartley <tb...@au1.ibm.com> 
wrote:
> > 
> > I am an Axis C++ newbie so please bare with me ... 
> > 
> > I am having trouble with serialization of an array parameter on the 
client
> > side. 
> > 
> > The array is of a complex type. 
> > 
> > The generated stubs create: 
> > 
> > typedef struct Complex { 
> >         xsd__string value1; 
> >         xsd__string value2; 
> >         xsd__string value3; 
> >         xsd__int value4; 
> >         Complex(); 
> >         ~Complex(); 
> > }; 
> > 
> > typedef struct Complex_ArrayTag { 
> >         Complex** m_Array; 
> >         int m_Size; 
> > }; 
> > 
> > I can't find any Axis C++ samples using arrays of complex types. 
> > 
> > I have code similar to the following to initialize the array. 
> > 
> > Complex* data = new Complex[size]; 
> > 
> > <initialize data elements> 
> > 
> > Complex_Array array; 
> > array.m_Array = new Complex*[size]; 
> > array.m_Size = size; 
> > for (int i = 0; i < size; ++i) { 
> >         array.m_Array[i] = &data[i]; 
> > } 
> > 
> > when I step through the generated Axis_Serialize_Complex function the
> > "Complex* param" parameter appears to really be a "Complex** param". 
This
> > results in horrible binary data being included in the request which is 
then
> > generally rejected by the server. 
> > 
> > Am I setting up my Complex_Array incorrectly or is this a bug? 
I'musing the
> > 1.4 stable release on Linux and have just tried this with the new 1.5 
alpha
> > with the same result. 
> > 
> > Regarsd, 
> > 
> > Tim Bartley 
> > --
> >  IBM Tivoli Access Manager Development
> >  Gold Coast Development Lab, Australia
> >  +61-7-5552-4001 phone
> >  +61-7-5571-0420 fax

Re: Array serialization?

Posted by Samisa Abeysinghe <sa...@gmail.com>.
I have the gut feel that this happens due to the fact that Complex
class do not have a copy constructor.

To verify this, can you please change your code to the following and
test again please:

 Complex* data = new Complex[size]; 
  
 <initialize data elements> 
  
 Complex_Array array; 
 array.m_Array = data;
 array.m_Size = size; 

Thanks,
Samisa...

On Wed, 9 Feb 2005 15:24:15 +1000, Tim Bartley <tb...@au1.ibm.com> wrote:
>  
> I am an Axis C++ newbie so please bare with me ... 
>  
> I am having trouble with serialization of an array parameter on the client
> side. 
>  
> The array is of a complex type. 
>  
> The generated stubs create: 
>  
> typedef struct Complex { 
>         xsd__string value1; 
>         xsd__string value2; 
>         xsd__string value3; 
>         xsd__int value4; 
>         Complex(); 
>         ~Complex(); 
> }; 
>  
> typedef struct Complex_ArrayTag { 
>         Complex** m_Array; 
>         int m_Size; 
> }; 
>  
> I can't find any Axis C++ samples using arrays of complex types. 
>  
> I have code similar to the following to initialize the array. 
>  
> Complex* data = new Complex[size]; 
>  
> <initialize data elements> 
>  
> Complex_Array array; 
> array.m_Array = new Complex*[size]; 
> array.m_Size = size; 
> for (int i = 0; i < size; ++i) { 
>         array.m_Array[i] = &data[i]; 
> } 
>  
> when I step through the generated Axis_Serialize_Complex function the
> "Complex* param" parameter appears to really be a "Complex** param". This
> results in horrible binary data being included in the request which is then
> generally rejected by the server. 
>  
> Am I setting up my Complex_Array incorrectly or is this a bug? I'm using the
> 1.4 stable release on Linux and have just tried this with the new 1.5 alpha
> with the same result. 
>  
> Regarsd, 
>  
> Tim Bartley 
> --
>  IBM Tivoli Access Manager Development
>  Gold Coast Development Lab, Australia
>  +61-7-5552-4001 phone
>  +61-7-5571-0420 fax