axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Dick <adrian.d...@uk.ibm.com>
Subject Re: Bug in serializeAsChardata with new xsd types [was Re: cvs commit: ws-axis/c/src/soap SoapSerializer.cpp]
Date Fri, 28 Jan 2005 12:37:51 GMT
I've just taken a look, and I think I understand the problem.

When develoing these XSD objects, I had been working in
BasicTypeSerializer::serializeElementAs<element/attribute>(), and have been
thoroughtly testing this throughout.

I had initially been intending on deleting/deprecating the
SoapSerializer::serializeAsChardata() method, as I couldn't find any
evidence of it's being used.   However, since starting this piece of work,
the SoapAttachments works has commenced and is making use of this method.
So I quickly converted it to use the XSD objects, regretably I have no
tests which exercise this function, which is part of the reason why you're
now seeing these problem

I believe I have a fix for the problems you're seeing, as you seem to have
tests which exercise this area of code I would be very grateful if could
you try the attached patch to SoapSerializer.cpp.
(See attached file: SoapSerializer.cpp.patch)


Apologies for the inconvenience
Adrian

_______________________________________
Adrian Dick (adrian.dick@uk.ibm.com)


Roshan Weerasuriya <roshan@opensource.lk> wrote on 28/01/2005 11:51:40:

> hi All,
>
> >   int SoapSerializer::serializeAsChardata(void* pValue, XSDTYPE type)
> >    {
> >   -    const char* pStr = m_Buf;
> >   +    char* pStr = m_Buf;
> >        switch (type)
> >        {
> >        case XSD_INT:
> >   @@ -1031,7 +1046,8 @@
> >       case XSD_BASE64BINARY:
> >            {
> >                Base64Binary base64BinarySerializer;
> >   -            pStr = base64BinarySerializer.serialize(pValue);
> >   +            //pStr = base64BinarySerializer.serialize(pValue);
> >   +            strcpy(pStr, base64BinarySerializer.
> serialize(pValue));
> >            }
> >            break;
> >        case XSD_DATETIME:
>
> I also came accross this problem. The moment it finishes this case block
> of XSD_BASE64BINARY , the value of pStr became garbage. I think Rangika
> has corrected this. Also I think may be it is the same for all the other
> types under this method.
>
> Is this change done by Rangika OK, who ever did work on this new xsd
> types, might know the exact reason for this. When I debug it goes inside
> the new xsd Base64.., IAnyType.. and the moment it finishes and the
> moment it finishes this case block the value of pStr become garbage.
>
> Roshan
>
> On Fri, 2005-01-28 at 17:17, rangika@apache.org wrote:
> > rangika     2005/01/28 03:17:08
> >
> >   Modified:    c/src/soap SoapSerializer.cpp
> >   Log:
> >   serializeAsCharData() doesn't serialize base64 properly.So I modified
it.
> >
> >   Revision  Changes    Path
> >   1.91      +18 -2     ws-axis/c/src/soap/SoapSerializer.cpp
> >
> >   Index: SoapSerializer.cpp
> >   ===================================================================
> >   RCS file: /home/cvs/ws-axis/c/src/soap/SoapSerializer.cpp,v
> >   retrieving revision 1.90
> >   retrieving revision 1.91
> >   diff -u -r1.90 -r1.91
> >   --- SoapSerializer.cpp   27 Jan 2005 08:32:37 -0000   1.90
> >   +++ SoapSerializer.cpp   28 Jan 2005 11:17:08 -0000   1.91
> >   @@ -250,6 +250,21 @@
> >        if(m_pSoapEnvelope)
> >        {
> >          if (checkAttachmentAvailability()) {
> >   +
> >   +            string asStartID;
> >   +            string asSOAPMimeHeaders;
> >   +            asSOAPMimeHeaders   =
pStream->getIncomingSOAPMimeHeaders();
> >   +            int start= asSOAPMimeHeaders.find("Content-Type");
> >   +            int startPosIdValue = asSOAPMimeHeaders.find ("<",
> start+strlen("Content-Id:"))+1;
> >   +            int endPosIdValue   = asSOAPMimeHeaders.find(">",
> start+strlen("Content-Type"));
> >   +            int length          = endPosIdValue - startPosIdValue ;
> >   +            asStartID           = asSOAPMimeHeaders.substr
> (startPosIdValue,length);
> >   +
> >   +            string * asContentType = new
> string("multipart/related; type=\"text/xml\"; start=\"<");
> >   +            *asContentType=*asContentType + asStartID + ">\"";
> >   +            *asContentType=*asContentType +";
> boundary=\"------=MIME BOUNDARY\"";
> >   +            pStream->setTransportProperty(CONTENT_TYPE,
> (*asContentType).c_str());
> >   +
> >             serialize("\n------=MIME BOUNDARY\n", NULL);
> >             serialize(pStream->getIncomingSOAPMimeHeaders(), "\n\n",
NULL);
> >          }
> >   @@ -912,7 +927,7 @@
> >
> >    int SoapSerializer::serializeAsChardata(void* pValue, XSDTYPE type)
> >    {
> >   -    const char* pStr = m_Buf;
> >   +    char* pStr = m_Buf;
> >        switch (type)
> >        {
> >        case XSD_INT:
> >   @@ -1031,7 +1046,8 @@
> >        case XSD_BASE64BINARY:
> >            {
> >                Base64Binary base64BinarySerializer;
> >   -            pStr = base64BinarySerializer.serialize(pValue);
> >   +            //pStr = base64BinarySerializer.serialize(pValue);
> >   +            strcpy(pStr, base64BinarySerializer.
> serialize(pValue));
> >            }
> >            break;
> >        case XSD_DATETIME:
> >
> >
> >
> >
>
Mime
View raw message