From axis-c-dev-return-12696-apmail-ws-axis-c-dev-archive=ws.apache.org@ws.apache.org Mon Dec 18 13:05:46 2006 Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 40970 invoked from network); 18 Dec 2006 13:05:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Dec 2006 13:05:45 -0000 Received: (qmail 58266 invoked by uid 500); 18 Dec 2006 13:05:53 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 58118 invoked by uid 500); 18 Dec 2006 13:05:52 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 58107 invoked by uid 99); 18 Dec 2006 13:05:52 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2006 05:05:52 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2006 05:05:44 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1A448714286 for ; Mon, 18 Dec 2006 05:05:24 -0800 (PST) Message-ID: <25051330.1166447124105.JavaMail.jira@brutus> Date: Mon, 18 Dec 2006 05:05:24 -0800 (PST) From: "Franz Fehringer (JIRA)" To: axis-c-dev@ws.apache.org Subject: [jira] Commented: (AXISCPP-972) axis-c deserializer has a problem: X-Virus-Checked: Checked by ClamAV on apache.org 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 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