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 Rob Blanchard <bo...@access4less.net> on 2004/11/15 15:23:13 UTC

Returning Structures Containing Arrays

Help!

I'm trying to use Axis-C++ to create a client and server, where the 
return from the server is a structure that contains an array and two 
doubles.

I have successfully been able to create a server that returns a 
structure containing two doubles, or a server that returns an array.  
But when I try to make a server that returns a more complicated 
structure (containing an array), my client segfaults on me - it appears 
to be some problem with the SoapDeSerializer function.  It seems to 
parse out the array fine, but when it gets to the double, it returns an 
AXIS_FAIL.

Anyone have any ideas what I might be doing wrong, or what additional 
information may be needed to solve this?

Thanks,
Rob Blanchard

Re: Returning Structures Containing Arrays

Posted by "Robert J. Blanchard" <bo...@access4less.net>.
Samisa...

Actually, I was doing a little sleuthing and found there is a problem in the
SoapDeSerializer.cpp file in the getBasicArray method.

When I looked this morning over at the axis-c-dev mailing list, it seems
someone else has reached the same conclusion:


QUOTE:
[AXIS C++ 1.3] Bug in SoapDeSerializer::getBasicArray when there is more
than one array

Using axis-c 1.3, I could not get these two vectors, I could get only
one of them.
After some investigation, I found that
SoapDeSerializer::getBasicArray() always get the first next node and after
some
debug, I discovered that the next node was </docsArray> which failed in all
cases.

In order to get the next node not null, I patch the method :
--- axis-c-src-1-3-linux/src/soap/SoapDeSerializer.cpp 2004-10-22
14:50:49.000000000 +0200
+++ axis-c-src-1-3-linux.modif/src/soap/SoapDeSerializer.cpp 2004-11-15
13:59:12.000000000 +0100
@@ -726,10 +726,11 @@
     free(Array.m_Array);\
     Array.m_Array = 0;\
     Array.m_Size = 0;\
     return Array;\
 }\
+m_pNode = m_pParser->next(); /* skip end element node */\
 return Array;

 #define DESERIALIZE_LITERAL_ARRAY_BLOCK(cpp_type, conv_func) \
             Array.m_Array = malloc(sizeof(cpp_type)*INITIAL_ARRAY_SIZE);\
             if (!Array.m_Array) return Array;\
@@ -848,10 +849,11 @@
                     free(Array.m_Array);
                     Array.m_Array = 0;
                     Array.m_Size = 0;
                     return Array;
                 }
+                m_pNode = m_pParser->next(); /* skip end element node */
                 return Array;
             case XSD_UNSIGNEDINT:
                 DESERIALIZE_ENCODED_ARRAY_BLOCK(unsigned int, CONV_STRTOUL)
             case XSD_SHORT:
                 DESERIALIZE_ENCODED_ARRAY_BLOCK(short, CONV_STRTOL)

ENDQUOTE


I implemented the same change on my end, and now the code works correctly.
I would concur with Julien Lemoine that this is a necessary fix.

Thanks,
Rob



----- Original Message ----- 
From: "Samisa Abeysinghe" <sa...@yahoo.com>
To: "Apache AXIS C User List" <ax...@ws.apache.org>
Sent: Monday, November 15, 2004 8:16 PM
Subject: Re: Returning Structures Containing Arrays


> Hi Rob,
>     Do you have a WSDL for your service? If so please send it over to
recreate the situation along
> with the client/server code.
> Thanks,
> Samisa...
>
> --- Rob Blanchard <bo...@access4less.net> wrote:
>
> > Help!
> >
> > I'm trying to use Axis-C++ to create a client and server, where the
> > return from the server is a structure that contains an array and two
> > doubles.
> >
> > I have successfully been able to create a server that returns a
> > structure containing two doubles, or a server that returns an array.
> > But when I try to make a server that returns a more complicated
> > structure (containing an array), my client segfaults on me - it appears
> > to be some problem with the SoapDeSerializer function.  It seems to
> > parse out the array fine, but when it gets to the double, it returns an
> > AXIS_FAIL.
> >
> > Anyone have any ideas what I might be doing wrong, or what additional
> > information may be needed to solve this?
> >
> > Thanks,
> > Rob Blanchard



Re: Returning Structures Containing Arrays

Posted by Samisa Abeysinghe <sa...@yahoo.com>.
Hi Rob,
    Do you have a WSDL for your service? If so please send it over to recreate the situation along
with the client/server code.
Thanks,
Samisa...

--- Rob Blanchard <bo...@access4less.net> wrote:

> Help!
> 
> I'm trying to use Axis-C++ to create a client and server, where the 
> return from the server is a structure that contains an array and two 
> doubles.
> 
> I have successfully been able to create a server that returns a 
> structure containing two doubles, or a server that returns an array.  
> But when I try to make a server that returns a more complicated 
> structure (containing an array), my client segfaults on me - it appears 
> to be some problem with the SoapDeSerializer function.  It seems to 
> parse out the array fine, but when it gets to the double, it returns an 
> AXIS_FAIL.
> 
> Anyone have any ideas what I might be doing wrong, or what additional 
> information may be needed to solve this?
> 
> Thanks,
> Rob Blanchard
> 



		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com