axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nadir Amra <a...@us.ibm.com>
Subject Re: [jira] Commented: (AXISCPP-972) axis-c deserializer has a problem:
Date Tue, 19 Dec 2006 03:14:45 GMT
Yes, will try to get it in next couple of weeks. 

Nadir K. Amra


"Franz Fehringer (JIRA)" <axis-c-dev@ws.apache.org> wrote on 12/18/2006 
07:05:24 AM:

> axis-c deserializer: IWrapperSoapDeSerializer::getChardataAs 's
>  declaration and definition should be changed as by reference, not by 
value,
>  in order to output the required value by it's parameter pValue.
> In-Reply-To: <31856127.1149476969806.JavaMail.jira@brutus>
> MIME-Version: 1.0
> Content-Type: text/plain; charset=utf-8
> Content-Transfer-Encoding: 7bit
> 
>     [ http://issues.apache.org/jira/browse/AXISCPP-972?
> page=comments#action_12459307 ] 
> 
> Franz Fehringer commented on AXISCPP-972:
> -----------------------------------------
> 
>  Hello Nadir,
> 
> I found out, that your fix for the getChardataAs() problem does not 
> cover all possible cases.
> More to the point it only works if the C/C++ Variable where the 
> character data is to be read in is of pointer type (which in this 
> situation means mostly xsd_string or xsd__nmtoken i.e. char*).
> If the character data is to be read into a double say, then
> 
>     * the levels of (de)referencing are wrong.
>     * (on my computer at least) a double (8 byte) does not fit into 
> a void* (4 byte).
> 
> The XSD snippet exposing this problem is
> 
>     <xsd:simpleType name="t_AmountOfMoney">
>         <xsd:restriction base="xsd:double">
>             <xsd:maxExclusive value="100000000000000000000"/>
>             <!--<xsd:fractionDigits value="10"/>-->
>             <xsd:minInclusive value="0"/>
>         </xsd:restriction>
>     </xsd:simpleType>
>     <xsd:complexType name="t_BuyRate">
>         <xsd:simpleContent>
>             <xsd:extension base="t_AmountOfMoney">
>                 <xsd:attribute name="currencyCode" 
> type="t_CurrencyCode" use="required"/>
>                 <xsd:attribute name="inclusiveOfTax" type="xsd:
> boolean" use="required"/>
>             </xsd:extension>
>         </xsd:simpleContent>
>     </xsd:complexType>
> 
> I resolved the problem by the changing SoapDeSerializer.cpp and 
> BeanParamWriter.java.
> The change in SoapDeSerializer.cpp is the same as proposed by 
> Michael Xiong but his BeanParamWriter.java change suffers from the 
> same problem as yours.
> Below you find the relevant diffs.
> Any chances for getting this into SVN?
> 
> Best regards
> 
> Franz
> 
> 
> Index: SoapDeSerializer.cpp
> ===================================================================
> --- SoapDeSerializer.cpp        (Revision 475161)
> +++ SoapDeSerializer.cpp        (Arbeitskopie)
> @@ -2522,7 +2522,7 @@
>  }
> 
>  void
> -SoapDeSerializer::getChardataAs (void **pValue,
> +SoapDeSerializer::getChardataAs (void*& pValue,
>                                   XSDTYPE type)
>  {
>      if (!m_pNode)
> @@ -2532,7 +2532,7 @@
>      {
>          IAnySimpleType* pSimpleType = AxisUtils::
> createSimpleTypeObject(type);
>          pSimpleType->deserialize(m_pNode->m_pchNameOrValue);
> -        *pValue = pSimpleType->getValue();
> +        pValue = pSimpleType->getValue();
>          delete pSimpleType;
>      }
>  }
> 
> Index: SoapDeSerializer.h
> ===================================================================
> --- SoapDeSerializer.h  (Revision 475161)
> +++ SoapDeSerializer.h  (Arbeitskopie)
> @@ -320,7 +320,7 @@
>      int AXISCALL getStatus(){return m_nStatus;};
>         AnyType* AXISCALL getAnyObject();
>      void serializeTag(AxisString& xmlStr, const AnyElement* node, 
> AxisString& nsDecls);
> -    void getChardataAs(void** pValue, XSDTYPE type);
> +    void getChardataAs(void*& pValue, XSDTYPE type);
> 
>      /**
>        *Returns the attachemtn object for the given id.
> 
> Index: axis/IWrapperSoapDeSerializer.hpp
> ===================================================================
> --- axis/IWrapperSoapDeSerializer.hpp   (Revision 475161)
> +++ axis/IWrapperSoapDeSerializer.hpp   (Arbeitskopie)
> @@ -964,7 +964,7 @@
>       * @param pValue object into which deserialized value will be 
placed
>       * @param type The xsd simple type of the data.
>       */
> -    virtual void getChardataAs(void** pValue,
> +    virtual void getChardataAs(void*& pValue,
>                                 XSDTYPE type)=0;
> 
>      /**
> 
> Index: BeanParamWriter.java
> ===================================================================
> --- BeanParamWriter.java        (Revision 475161)
> +++ BeanParamWriter.java        (Arbeitskopie)
> @@ -971,9 +971,18 @@
>          {
>              if (extensionBaseAttrib != null)
>              {
> -                writer.write("\tpIWSDZ->getChardataAs((void 
**)&(param->"
> -                        + extensionBaseAttrib.getParamNameAsMember() + 
"), "
> -                        + CUtils.
> getXSDTypeForBasicType(extensionBaseAttrib.getTypeName()) + ");\n");
> +                writer.write("\tvoid* pCharData;\n\n");
> +                String typeName = extensionBaseAttrib.getTypeName();
> +                String xsdType = 
CUtils.getXSDTypeForBasicType(typeName);
> +                writer.write("\tpIWSDZ->getChardataAs(pCharData, " 
> + xsdType + ");\n");
> +                if (CUtils.isPointerType(typeName))
> +                {
> +                    writer.write("\tparam->" + extensionBaseAttrib.
> getParamNameAsMember() + " = (" + typeName + ") pCha
> rData;\n");
> +                }
> +                else
> +                {
> +                    writer.write("\tparam->" + extensionBaseAttrib.
> getParamNameAsMember() + " = *(" + typeName + "*) pC
> harData;\n");
> +                }
>              }
>              else
>              {
> @@ -1248,9 +1257,18 @@
>          if (extensionBaseAttrib != null
>                  && extensionBaseAttrib.getTypeName() != null)
>          {
> -            writer.write("\tpIWSDZ->getChardataAs((void **)&(param->"
> -                    + extensionBaseAttrib.getParamNameAsMember() + "), 
"
> -                    + CUtils.
> getXSDTypeForBasicType(extensionBaseAttrib.getTypeName()) + ");\n");
> +            writer.write("\tvoid* pCharData;\n\n");
> +            String typeName = extensionBaseAttrib.getTypeName();
> +            String xsdType = CUtils.getXSDTypeForBasicType(typeName);
> +            writer.write("\tpIWSDZ->getChardataAs(pCharData, " + 
> xsdType + ");\n");
> +            if (CUtils.isPointerType(typeName))
> +            {
> +                writer.write("\tparam->" + extensionBaseAttrib.
> getParamNameAsMember() + " = (" + typeName + ") pCharDat
> a;\n");
> +            }
> +            else
> +            {
> +               writer.write("\tparam->" + extensionBaseAttrib.
> getParamNameAsMember() + " = *(" + typeName + "*) pCharDa
> ta;\n");
> +            }
>          }
> 
>          writer.write("\treturn pIWSDZ->getStatus();\n");
> 
> 
> > axis-c deserializer has a problem: 
> axis-c deserializer: IWrapperSoapDeSerializer::getChardataAs 's 
> declaration and definition should be changed as by reference, not by
> value, in order to output the required value by it's parameter pValue.
> > 
> 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> >                 Key: AXISCPP-972
> >                 URL: http://issues.apache.org/jira/browse/AXISCPP-972
> >             Project: Axis-C++
> >          Issue Type: Bug
> >          Components: Server - Deserialization
> >    Affects Versions:  1.6 Beta
> >         Environment:       Platform:
> >         Linux fedora 3.0
> > Axis version:
> >         Server-side Axis C++ 1.6Beta
> > XML Parser Lib:
> > xersesc 2.6
> > WSDL2ws tool by using axis java 1.3
> > Client-side version Axis java 1.3
> > Http Server Version:
> > Apache 2.0.53
> > Tomcat 2.0.58
> >            Reporter: Michael Xiong
> >         Assigned To: nadir amra
> >            Priority: Critical
> >             Fix For:  1.6 Beta
> >
> >
> > axis-c deserializer has a problem: 
> > IWrapperSoapDeSerializer::getChardataAs 's declaration and 
> definition should be changed into by reference, not by value, in 
> order to output the required value by parameter pValue.
> > IWrapperSoapDeSerializer has declared an interface like the below:
> >     virtual void getChardataAs(void* pValue, XSDTYPE type)=0;
> > This interface is implemented in the class SoapDeSerializer like the 
below:
> > SoapDeSerializer::getChardataAs (void *pValue, XSDTYPE type)
> > {
> > ... ...
> >         pValue = pSimpleType->getValue();
> > ... ...
> > }
> > From the code inside SoapDeSerializer::getChardataAs, you can see 
> that the required value can not been really output by pValue for the
> pValue here is indeed  a pointer in local stack.
> > If you want to output the requireed value by pValue, you should 
> declare and define it by reference, not by value. 
> > The suggested solution of mine is like the below:
> > In include/axis/IWrapperSoapDeSerializer.hpp
> > change the interface(getChardataAs)'s declaration into:
> >    virtual void getChardataAs(void*& pValue, XSDTYPE type)=0;
> > In src/soap/SoapDeserializer.h, change the 
> method(SoapDeSerializer::getChardataAs)'s declaration into:
> >     void getChardataAs(void*& pValue, XSDTYPE type);
> > In src/soap/SoapDeserializer.cpp, change the 
> method(SoapDeSerializer::getChardataAs)'s definition into:
> > SoapDeSerializer::getChardataAs (void *& pValue, XSDTYPE type)
> > {
> > ... 
> > }
> > Please notice that only the method's signature need to be 
> corrected, the internal code logic can remain no change.
> > And correspondingly, the WSDL2WS generated code framework need to 
> be corrected in the corresponding place. Detail please wait for 
> another bug which I will reported for WSDL2WS later.
> > I've verified my solution on axis-c-1.6beta, it's OK.
> 
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators: 
> http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see: 
http://www.atlassian.com/software/jira
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message