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");


begin:vcard
fn:Dr. Franz Fehringer
n:Fehringer;Franz
org:ISO Software Systeme
adr;quoted-printable:;;Eichendorffstrasse 29;N=C3=BCrnberg;;90491;Deutschland
email;internet:mailto:[EMAIL PROTECTED]
tel;work:+49/(911) - 99594-0 
tel;fax:+49/(911) - 99594-580
x-mozilla-html:TRUE
url:http://www.isogmbh.de/
version:2.1
end:vcard


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to