You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/14 16:06:47 UTC
svn commit: r356787 [1/2] - in /webservices/axis/trunk/c: include/axis/
src/common/ src/engine/ src/soap/ src/soap/xsd/
src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/
tests/auto_build/testcases/ tests/auto_build/testcases/client/cpp/
tests/auto_bui...
Author: dicka
Date: Wed Dec 14 07:06:03 2005
New Revision: 356787
URL: http://svn.apache.org/viewcvs?rev=356787&view=rev
Log:
Due to various memory leaks and occasional data corruption, I have modified the xsd__base64Binary and xsd__hexBinary objects.
This has resulted in some API changes, including the encapsulation of member data and provision of appropriate get/set methods.
I also took the opportunity to provide an '=' operator, which allows the generated code to be identical to that of any other xsd simple type.
I have modified all the test cases affected by this change to reflect the updated API, and have added one new test (XSD_base64BinaryTestValidData) case, to ensure data corruption doesn't occur.
Added:
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryTestValidDataClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/output/XSD_base64BinaryTestValidData.expected
webservices/axis/trunk/c/tests/auto_build/testcases/output/XSD_base64BinaryTestValidData_ServerResponse.expected
webservices/axis/trunk/c/tests/auto_build/testcases/tests/XSD_base64BinaryTestValidData.xml
Modified:
webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp
webservices/axis/trunk/c/src/common/ArrayBean.cpp
webservices/axis/trunk/c/src/common/AxisUserAPI.cpp
webservices/axis/trunk/c/src/common/AxisUtils.cpp
webservices/axis/trunk/c/src/engine/Axis.cpp
webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp
webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp
webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerExecuteClass.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerImage.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerText.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachment.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachmentFault.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiSameAttachment.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttNillableAttachment.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainText.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainTextSSL.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1DocClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDAttributeClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64Binary2Client.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryAttributeClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryAttributeClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/nillableComplexTypeClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/dynamic/DynUnrefAttachmentTest/DynUnrefAttachmentTest.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/dynamic/DynamicAttachment/DynamicAttachment.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list
Modified: webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp (original)
+++ webservices/axis/trunk/c/include/axis/AxisUserAPI.hpp Wed Dec 14 07:06:03 2005
@@ -276,7 +276,13 @@
class STORAGE_CLASS_INFO xsd__base64Binary {
public:
xsd__base64Binary();
+ xsd__base64Binary(xsd__base64Binary & original);
~xsd__base64Binary();
+ void set(xsd__unsignedByte * data, xsd__int size);
+ xsd__unsignedByte * get(xsd__int & size) const;
+ xsd__int getSize(void) const;
+ xsd__base64Binary & operator=(xsd__base64Binary & original);
+private:
xsd__unsignedByte * __ptr;
xsd__int __size;
};
@@ -288,7 +294,13 @@
class STORAGE_CLASS_INFO xsd__hexBinary {
public:
xsd__hexBinary();
+ xsd__hexBinary(xsd__hexBinary & original);
~xsd__hexBinary();
+ void set(xsd__unsignedByte * data, xsd__int size);
+ xsd__unsignedByte * get(xsd__int & size) const;
+ xsd__int getSize(void) const;
+ xsd__hexBinary & operator=(xsd__hexBinary & original);
+private:
xsd__unsignedByte * __ptr;
xsd__int __size;
};
Modified: webservices/axis/trunk/c/src/common/ArrayBean.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/common/ArrayBean.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/ArrayBean.cpp (original)
+++ webservices/axis/trunk/c/src/common/ArrayBean.cpp Wed Dec 14 07:06:03 2005
@@ -126,20 +126,12 @@
case XSD_HEXBINARY:
{
xsd__hexBinary* a = (xsd__hexBinary*)m_value.sta;
- for (int ix=0;ix<m_nSize;ix++)
- {
- delete [] a[ix].__ptr;
- }
delete [] a;
}
break;
case XSD_BASE64BINARY:
{
xsd__base64Binary* a = (xsd__base64Binary*)m_value.sta;
- for (int ix=0;ix<m_nSize;ix++)
- {
- delete [] a[ix].__ptr;
- }
delete [] a;
}
break;
Modified: webservices/axis/trunk/c/src/common/AxisUserAPI.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/common/AxisUserAPI.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/AxisUserAPI.cpp (original)
+++ webservices/axis/trunk/c/src/common/AxisUserAPI.cpp Wed Dec 14 07:06:03 2005
@@ -36,20 +36,138 @@
* which they both inherit from. Maybe these classes could have private data
* and overload the [] operator and size() methods.
*/
-xsd__base64Binary::xsd__base64Binary() {
- __ptr = 0;
+xsd__base64Binary::xsd__base64Binary()
+{
+ __ptr = NULL;
__size = 0;
}
-xsd__base64Binary::~xsd__base64Binary() {
+xsd__base64Binary::xsd__base64Binary(xsd__base64Binary & original)
+{
+ __ptr = NULL;
+ __size = 0;
+ *this = original;
}
-xsd__hexBinary::xsd__hexBinary() {
- __ptr = 0;
- __size = 0;
+void xsd__base64Binary::set(xsd__unsignedByte * data, int size)
+{
+ if (__ptr != NULL)
+ {
+ delete [] __ptr;
+ }
+ if (size > 0)
+ {
+ __ptr = new xsd__unsignedByte[size + 1];
+ memcpy(__ptr, data, size * sizeof(xsd__unsignedByte));
+ __ptr[size] = '\0';
+ }
+ else
+ {
+ __ptr = NULL;
+ }
+ __size = size;
+}
+
+xsd__int xsd__base64Binary::getSize() const
+{
+ return __size;
+}
+
+xsd__unsignedByte * xsd__base64Binary::get(xsd__int & size) const
+{
+ size = __size;
+ xsd__unsignedByte * pReturn = NULL;
+
+ if (size > 0)
+ {
+ pReturn = new xsd__unsignedByte[size + 1];
+ memcpy(pReturn, __ptr, size * sizeof(xsd__unsignedByte));
+ pReturn[size] = '\0';
+ }
+ return pReturn;
+}
+
+xsd__base64Binary & xsd__base64Binary::operator=(xsd__base64Binary & original)
+{
+ this->set(original.__ptr, original.__size);
+ return *this;
+}
+
+xsd__base64Binary::~xsd__base64Binary()
+{
+ if (__ptr != NULL)
+ {
+ delete [] __ptr;
+ }
+ __ptr = NULL;
+ __size = 0;
}
-xsd__hexBinary::~xsd__hexBinary() {
+xsd__hexBinary::xsd__hexBinary()
+{
+ __ptr = NULL;
+ __size = 0;
+}
+
+xsd__hexBinary::xsd__hexBinary(xsd__hexBinary & original)
+{
+ __ptr = NULL;
+ __size = 0;
+ *this = original;
+}
+
+void xsd__hexBinary::set(xsd__unsignedByte * data, int size)
+{
+ if (__ptr != NULL)
+ {
+ delete [] __ptr;
+ }
+ if (size > 0)
+ {
+ __ptr = new xsd__unsignedByte[size + 1];
+ memcpy(__ptr, data, size * sizeof(xsd__unsignedByte));
+ __ptr[size] = '\0';
+ }
+ else
+ {
+ __ptr = NULL;
+ }
+ __size = size;
+}
+
+xsd__int xsd__hexBinary::getSize() const
+{
+ return __size;
+}
+
+xsd__unsignedByte * xsd__hexBinary::get(xsd__int & size) const
+{
+ size = __size;
+ xsd__unsignedByte * pReturn = NULL;
+
+ if (size > 0)
+ {
+ pReturn = new xsd__unsignedByte[size + 1];
+ memcpy(pReturn, __ptr, size * sizeof(xsd__unsignedByte));
+ pReturn[size] = '\0';
+ }
+ return pReturn;
+}
+
+xsd__hexBinary & xsd__hexBinary::operator=(xsd__hexBinary & original)
+{
+ this->set(original.__ptr, original.__size);
+ return *this;
+}
+
+xsd__hexBinary::~xsd__hexBinary()
+{
+ if (__ptr != NULL)
+ {
+ delete [] __ptr;
+ }
+ __ptr = NULL;
+ __size = 0;
}
AnyType::AnyType() {
@@ -247,24 +365,14 @@
}
case XSD_BASE64BINARY:
{
- xsd__base64Binary* pCloneTemp = new xsd__base64Binary();
- xsd__base64Binary* pOriginalTemp = ((xsd__base64Binary**) array)[count];
-
- pCloneTemp->__size = pOriginalTemp->__size;
- pCloneTemp->__ptr = new unsigned char[pCloneTemp->__size];
- memcpy( pCloneTemp->__ptr, pOriginalTemp->__ptr, pCloneTemp->__size);
- ((xsd__base64Binary**) m_Array)[count] = pCloneTemp;
+ ((xsd__base64Binary**) m_Array)[count] = new xsd__base64Binary();
+ *((xsd__base64Binary**)m_Array)[count] = *((xsd__base64Binary**) array)[count];
break;
}
case XSD_HEXBINARY:
{
- xsd__hexBinary* pCloneTemp = new xsd__hexBinary();
- xsd__hexBinary* pOriginalTemp = ((xsd__hexBinary**) array)[count];
-
- pCloneTemp->__size = pOriginalTemp->__size;
- pCloneTemp->__ptr = new unsigned char[pCloneTemp->__size];
- memcpy( pCloneTemp->__ptr, pOriginalTemp->__ptr, pCloneTemp->__size);
- ((xsd__hexBinary**) m_Array)[count] = pCloneTemp;
+ ((xsd__hexBinary**) m_Array)[count] = new xsd__hexBinary();
+ *((xsd__hexBinary**)m_Array)[count] = *((xsd__hexBinary**) array)[count];
break;
}
case XSD_FLOAT:
@@ -570,24 +678,14 @@
}
case XSD_BASE64BINARY:
{
- xsd__base64Binary* pCloneTemp = new xsd__base64Binary();
- xsd__base64Binary* pOriginalTemp = (xsd__base64Binary*) element;
-
- pCloneTemp->__size = pOriginalTemp->__size;
- pCloneTemp->__ptr = new unsigned char[pCloneTemp->__size];
- memcpy( pCloneTemp->__ptr, pOriginalTemp->__ptr, pCloneTemp->__size);
- ((xsd__base64Binary**) m_Array)[m_Size] = pCloneTemp;
+ ((xsd__base64Binary**) m_Array)[m_Size] = new xsd__base64Binary();
+ *((xsd__base64Binary**)m_Array)[m_Size] = *(xsd__base64Binary*) element;
break;
}
case XSD_HEXBINARY:
{
- xsd__hexBinary* pCloneTemp = new xsd__hexBinary();
- xsd__hexBinary* pOriginalTemp = (xsd__hexBinary*) element;
-
- pCloneTemp->__size = pOriginalTemp->__size;
- pCloneTemp->__ptr = new unsigned char[pCloneTemp->__size];
- memcpy( pCloneTemp->__ptr, pOriginalTemp->__ptr, pCloneTemp->__size);
- ((xsd__hexBinary**) m_Array)[m_Size] = pCloneTemp;
+ ((xsd__hexBinary**) m_Array)[m_Size] = new xsd__hexBinary();
+ *((xsd__hexBinary**)m_Array)[m_Size] = *(xsd__hexBinary*) element;
break;
}
case XSD_FLOAT:
Modified: webservices/axis/trunk/c/src/common/AxisUtils.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/common/AxisUtils.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/AxisUtils.cpp (original)
+++ webservices/axis/trunk/c/src/common/AxisUtils.cpp Wed Dec 14 07:06:03 2005
@@ -138,14 +138,12 @@
xsd__base64Binary * AxisUtils::decodeFromBase64Binary(const AxisChar *pValue)
{
xsd__base64Binary* value = new xsd__base64Binary();
- value->__size = apr_base64_decode_len (pValue);
- value->__ptr = new unsigned char[value->__size + 1];
- value->__size = apr_base64_decode_binary (value->__ptr, pValue);
- /* put null at the end because it enables the decoded string to be used
- * as a string
- */
- value->__ptr[value->__size] = 0;
-
+ int size = apr_base64_decode_len (pValue);
+ xsd__unsignedByte * pTemp = new unsigned char[size + 1];
+ size = apr_base64_decode_binary (pTemp, pValue);
+ pTemp[size] = 0; // Null terminate so it could be used as a string
+ value->set(pTemp, size);
+ delete [] pTemp;
return value;
}
Modified: webservices/axis/trunk/c/src/engine/Axis.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/engine/Axis.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/engine/Axis.cpp (original)
+++ webservices/axis/trunk/c/src/engine/Axis.cpp Wed Dec 14 07:06:03 2005
@@ -655,24 +655,12 @@
}
case XSD_BASE64BINARY:
{
- if( ((xsd__base64Binary*) pValue)->__ptr != NULL)
- {
- delete [] ((xsd__base64Binary*) pValue)->__ptr;
- ((xsd__base64Binary*) pValue)->__ptr = NULL;
- }
-
delete (xsd__base64Binary*) pValue;
pValue = NULL;
break;
}
case XSD_HEXBINARY:
{
- if( ((xsd__hexBinary*) pValue)->__ptr != NULL)
- {
- delete [] ((xsd__hexBinary*) pValue)->__ptr;
- ((xsd__hexBinary*) pValue)->__ptr = NULL;
- }
-
delete (xsd__hexBinary*) pValue;
pValue = NULL;
break;
Modified: webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp (original)
+++ webservices/axis/trunk/c/src/soap/SoapDeSerializer.cpp Wed Dec 14 07:06:03 2005
@@ -2226,28 +2226,24 @@
SoapDeSerializer::decodeFromBase64Binary (const AxisChar * pValue)
{
xsd__base64Binary value;
- value.__size = apr_base64_decode_len (pValue);
- value.__ptr = new unsigned char[value.__size + 1];
- value.__size = apr_base64_decode_binary (value.__ptr, pValue);
- /* put null at the end because it enables the decoded string to be used
- * as a string
- */
- value.__ptr[value.__size] = 0;
-
+ xsd__int size = apr_base64_decode_len (pValue);
+ xsd__unsignedByte * pTemp = new xsd__unsignedByte[size + 1];
+ size = apr_base64_decode_binary (pTemp, pValue);
+ pTemp[size] = 0; // Null terminate so it could used as a string
+ value.set(pTemp, size);
+ delete [] pTemp;
return value;
}
xsd__hexBinary SoapDeSerializer::decodeFromHexBinary (const AxisChar * pValue)
{
- xsd__hexBinary
- value;
- value.__size = strlen (pValue) / 2;
- value.__ptr = new unsigned char[value.__size + 1];
- Hex_Decode (value.__ptr, pValue);
- /* put null at the end because it enables the decoded string to be used
- * as a string
- */
- value.__ptr[value.__size] = 0;
+ xsd__hexBinary value;
+ xsd__int size = strlen (pValue) / 2;
+ xsd__unsignedByte * pTemp = new xsd__unsignedByte[size + 1];
+ Hex_Decode (pTemp, pValue);
+ pTemp[size] = 0; // Null terminate so it could be used as a string
+ value.set(pTemp, size);
+ delete [] pTemp;
return value;
}
Modified: webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/Base64Binary.cpp Wed Dec 14 07:06:03 2005
@@ -61,7 +61,7 @@
MinLength* minLength= getMinLength();
if (minLength->isSet())
{
- if (value->__size < minLength->getMinLength())
+ if (value->getSize() < minLength->getMinLength())
{
AxisString exceptionMessage =
"Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
@@ -69,7 +69,7 @@
sprintf(length, "%d", minLength->getMinLength());
exceptionMessage += length;
exceptionMessage += ", Length of value = ";
- sprintf(length, "%d", value->__size);
+ sprintf(length, "%d", value->getSize());
exceptionMessage += length;
exceptionMessage += ".";
delete [] length;
@@ -84,7 +84,7 @@
MaxLength* maxLength = getMaxLength();
if (maxLength->isSet())
{
- if (value->__size > maxLength->getMaxLength())
+ if (value->getSize() > maxLength->getMaxLength())
{
AxisString exceptionMessage =
"Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
@@ -92,7 +92,7 @@
sprintf(length, "%d", maxLength->getMaxLength());
exceptionMessage += length;
exceptionMessage += ", Length of value = ";
- sprintf(length, "%d", value->__size);
+ sprintf(length, "%d", value->getSize());
exceptionMessage += length;
exceptionMessage += ".";
delete [] length;
@@ -106,7 +106,7 @@
Length* length= getLength();
if (length->isSet())
{
- if (value->__size != length->getLength())
+ if (value->getSize() != length->getLength())
{
AxisString exceptionMessage =
"Length of value to be serialized is not the same as Length specified for this type. Length = ";
@@ -114,7 +114,7 @@
sprintf(lengthAsString, "%d", length->getLength());
exceptionMessage += lengthAsString;
exceptionMessage += ", Length of value = ";
- sprintf(lengthAsString, "%d", value->__size);
+ sprintf(lengthAsString, "%d", value->getSize());
exceptionMessage += lengthAsString;
exceptionMessage += ".";
delete [] lengthAsString;
@@ -125,9 +125,12 @@
}
delete length;
- int len = apr_base64_encode_len (value->__size);
+ int len = apr_base64_encode_len (value->getSize());
AxisChar* serializedValue = new AxisChar[len + 1];
- len = apr_base64_encode_binary (serializedValue, value->__ptr, value->__size);
+ int size = 0;
+ xsd__unsignedByte * pTemp = value->get(size);
+ len = apr_base64_encode_binary (serializedValue, pTemp, size);
+ delete [] pTemp;
serializedValue[len] = 0;
IAnySimpleType::serialize(serializedValue);
@@ -138,14 +141,12 @@
xsd__base64Binary * Base64Binary::deserializeBase64Binary(const AxisChar* valueAsChar) throw (AxisSoapException)
{
xsd__base64Binary * value = new xsd__base64Binary();
- value->__size = apr_base64_decode_len (valueAsChar);
- value->__ptr = new unsigned char[value->__size + 1];
- value->__size = apr_base64_decode_binary (value->__ptr, valueAsChar);
- /* put null at the end because it enables the decoded string to be used
- * as a string
- */
- value->__ptr[value->__size] = 0;
-
+ xsd__int size = apr_base64_decode_len (valueAsChar);
+ xsd__unsignedByte * pTemp = new xsd__unsignedByte[size + 1];
+ size = apr_base64_decode_binary (pTemp, valueAsChar);
+ pTemp[size] = 0; // Null terminate so it could be used as a string
+ value->set(pTemp, size);
+ delete [] pTemp;
return value;
}
Modified: webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp (original)
+++ webservices/axis/trunk/c/src/soap/xsd/HexBinary.cpp Wed Dec 14 07:06:03 2005
@@ -61,7 +61,7 @@
MinLength* minLength= getMinLength();
if (minLength->isSet())
{
- if (value->__size < minLength->getMinLength())
+ if (value->getSize() < minLength->getMinLength())
{
AxisString exceptionMessage =
"Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
@@ -69,7 +69,7 @@
sprintf(length, "%d", minLength->getMinLength());
exceptionMessage += length;
exceptionMessage += ", Length of value = ";
- sprintf(length, "%d", value->__size);
+ sprintf(length, "%d", value->getSize());
exceptionMessage += length;
exceptionMessage += ".";
delete [] length;
@@ -83,7 +83,7 @@
MaxLength* maxLength = getMaxLength();
if (maxLength->isSet())
{
- if (value->__size > maxLength->getMaxLength())
+ if (value->getSize() > maxLength->getMaxLength())
{
AxisString exceptionMessage =
"Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
@@ -91,7 +91,7 @@
sprintf(length, "%d", maxLength->getMaxLength());
exceptionMessage += length;
exceptionMessage += ", Length of value = ";
- sprintf(length, "%d", value->__size);
+ sprintf(length, "%d", value->getSize());
exceptionMessage += length;
exceptionMessage += ".";
delete [] length;
@@ -105,7 +105,7 @@
Length* length= getLength();
if (length->isSet())
{
- if (value->__size != length->getLength())
+ if (value->getSize() != length->getLength())
{
AxisString exceptionMessage =
"Length of value to be serialized is not the same as Length specified for this type. Length = ";
@@ -113,7 +113,7 @@
sprintf(lengthAsString, "%d", length->getLength());
exceptionMessage += lengthAsString;
exceptionMessage += ", Length of value = ";
- sprintf(lengthAsString, "%d", value->__size);
+ sprintf(lengthAsString, "%d", value->getSize());
exceptionMessage += lengthAsString;
exceptionMessage += ".";
delete [] lengthAsString;
@@ -124,9 +124,12 @@
}
delete length;
- char* serializedValue = new char[value->__size * 2 + 1];
- Hex_Encode (serializedValue, value->__ptr, value->__size);
- serializedValue[value->__size * 2] = 0;
+ char* serializedValue = new char[value->getSize() * 2 + 1];
+ int size = 0;
+ xsd__unsignedByte * pTemp = value->get(size);
+ Hex_Encode (serializedValue, pTemp, size);
+ delete [] pTemp;
+ serializedValue[value->getSize() * 2] = 0;
IAnySimpleType::serialize(serializedValue);
delete [] serializedValue;
@@ -136,13 +139,12 @@
xsd__hexBinary * HexBinary::deserializeHexBinary(const AxisChar* valueAsChar) throw (AxisSoapException)
{
xsd__hexBinary * value = new xsd__hexBinary();
- value->__size = strlen (valueAsChar) / 2;
- value->__ptr = new unsigned char[value->__size + 1];
- Hex_Decode (value->__ptr, valueAsChar);
- /* put null at the end because it enables the decoded string to be used
- * as a string
- */
- value->__ptr[value->__size] = 0;
+ int size = strlen (valueAsChar) / 2;
+ xsd__unsignedByte * pTemp = new xsd__unsignedByte[size + 1];
+ Hex_Decode (pTemp, valueAsChar);
+ pTemp[size] = 0; // Null terminate so it could be used as a string
+ value->set(pTemp, size);
+ delete [] pTemp;
return value;
}
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java Wed Dec 14 07:06:03 2005
@@ -1050,17 +1050,8 @@
writer.write("\t\tparam->"
+ attribs[i].getParamNameAsMember() + " = *( "
+ attribs[i].getParamNameAsMember() + " );\n");
-
- if (attribs[i].getTypeName().equals("xsd__hexBinary")
- || attribs[i].getTypeName().equals("xsd__base64Binary"))
- {
- writer.write("\t}\n");
- }
- else
- {
- writer.write("\t\tAxis::AxisDelete( (void *) " + attribs[i].getParamNameAsMember() + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
- writer.write("\t}\n");
- }
+ writer.write("\t\tAxis::AxisDelete( (void *) " + attribs[i].getParamNameAsMember() + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
+ writer.write("\t}\n");
}
}
if (attribs[i].isOptional())
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java Wed Dec 14 07:06:03 2005
@@ -447,16 +447,6 @@
}
else
{
-
- if (outparamType.equals ("xsd__base64Binary")
- || outparamType.equals ("xsd__hexBinary"))
- {
- writer.write (outparamType + " Ret;\n");
- writer.write ("\tRet.__ptr = NULL;\n");
- writer.write ("\tRet.__size = 0;\n");
- }
- else
- {
if (outparamType.equals ("xsd__dateTime")
|| outparamType.equals ("xsd__date")
|| outparamType.equals ("xsd__time"))
@@ -469,7 +459,6 @@
{
writer.write (outparamType + " Ret;\n");
}
- }
}
}
}
@@ -1094,32 +1083,16 @@
writer.write( "\n");
writer.write( "\t\t\tif( pReturn != NULL)\n");
writer.write( "\t\t\t{\n");
- if( "xsd__base64Binary".equals( outparamType) ||
- "xsd__hexBinary".equals( outparamType))
- {
- writer.write( "\t\t\t\tRet = new " + outparamType + "();\n");
- writer.write ("\t\t\t\tif( pReturn->__ptr != NULL)\n");
- writer.write ("\t\t\t\t{\n");
- writer.write ("\t\t\t\t\tRet->__ptr = new xsd__unsignedByte [pReturn->__size + 1];\n");
- writer.write ("\t\t\t\t\tRet->__size = pReturn->__size;\n");
- writer.write ("\t\t\t\t\tmemcpy( Ret->__ptr, pReturn->__ptr, pReturn->__size);\n");
- writer.write ("\t\t\t\t}\n");
- writer.write ("\t\t\t\telse\n");
- writer.write ("\t\t\t\t{\n");
- writer.write ("\t\t\t\t\tRet->__ptr = NULL;\n");
- writer.write ("\t\t\t\t\tRet->__size = pReturn->__size;\n");
- writer.write ("\t\t\t\t}\n");
- }
- else if( CUtils.isPointerType(outparamType))
- {
- writer.write( "\t\t\t\tRet = new char[strlen( pReturn) + 1];\n");
- writer.write( "\t\t\t\tstrcpy( Ret, pReturn);\n");
- }
- else
- {
- writer.write( "\t\t\t\tRet = new " + outparamType + "();\n");
- writer.write( "\t\t\t\t*Ret = *pReturn;\n");
- }
+ if( CUtils.isPointerType(outparamType))
+ {
+ writer.write( "\t\t\t\tRet = new char[strlen( pReturn) + 1];\n");
+ writer.write( "\t\t\t\tstrcpy( Ret, pReturn);\n");
+ }
+ else
+ {
+ writer.write( "\t\t\t\tRet = new " + outparamType + "();\n");
+ writer.write( "\t\t\t\t*Ret = *pReturn;\n");
+ }
writer.write( "\t\t\t\tAxis::AxisDelete( (void *) pReturn, " + CUtils.getXSDTypeForBasicType( outparamType) + ");\n");
writer.write( "\t\t\t}\n");
writer.write( "\t\t}\n");
@@ -1156,22 +1129,7 @@
writer.write ("\t\t\tif(pReturn)\n");
writer.write ("\t\t\t{\n");
- if( "xsd__base64Binary".equals( outparamType) ||
- "xsd__hexBinary".equals( outparamType))
- {
- writer.write ("\t\t\t\tif( pReturn->__ptr != NULL)\n");
- writer.write ("\t\t\t\t{\n");
- writer.write ("\t\t\t\t\tRet.__ptr = new xsd__unsignedByte [pReturn->__size + 1];\n");
- writer.write ("\t\t\t\t\tRet.__size = pReturn->__size;\n");
- writer.write ("\t\t\t\t\tmemcpy( Ret.__ptr, pReturn->__ptr, pReturn->__size);\n");
- writer.write ("\t\t\t\t}\n");
- writer.write ("\t\t\t\telse\n");
- writer.write ("\t\t\t\t{\n");
- writer.write ("\t\t\t\t\tRet.__ptr = NULL;\n");
- writer.write ("\t\t\t\t\tRet.__size = pReturn->__size;\n");
- writer.write ("\t\t\t\t}\n");
- }
- else if( CUtils.isPointerType( outparamType))
+ if( CUtils.isPointerType( outparamType))
{
writer.write ("\t\t\t\tRet = *pReturn;\n");
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerExecuteClass.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerExecuteClass.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerExecuteClass.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerExecuteClass.cpp Wed Dec 14 07:06:03 2005
@@ -74,8 +74,7 @@
//Adding the content type as plain/text
att->addHeader(AXIS_CONTENT_TYPE,"plain/text");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)buffer;
- b64b1.__size = length;
+ b64b1.set((xsd__unsignedByte*) buffer, length);
att->addBody(&b64b1);
//Calling the dataHandlerService, service will return result of execution of the class file
xsd__string Result=ws.executeClass(att,"TestClass");
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerImage.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerImage.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerImage.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerImage.cpp Wed Dec 14 07:06:03 2005
@@ -73,8 +73,7 @@
//Adding the content type as image/jpeg
att->addHeader(AXIS_CONTENT_TYPE,"image/jpeg");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)buffer;
- b64b1.__size = length;
+ b64b1.set((xsd__unsignedByte *) buffer, length);
att->addBody(&b64b1);
//Calling the dataHandlerService, service will return number of bytes send
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerText.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerText.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerText.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttDataHandlerText.cpp Wed Dec 14 07:06:03 2005
@@ -56,8 +56,7 @@
//Adding the content type as text/plain
att->addHeader(AXIS_CONTENT_TYPE,"text/plain");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)text;
- b64b1.__size = strlen(text);
+ b64b1.set((xsd__unsignedByte *) text, strlen(text));
att->addBody(&b64b1);
//Calling the dataHandlerService, service will return content
Result=ws.echoContent(att);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachment.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachment.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachment.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachment.cpp Wed Dec 14 07:06:03 2005
@@ -62,8 +62,7 @@
att2->addHeader(AXIS_CONTENT_ID,"5");
att2->addHeader(AXIS_CONTENT_TYPE,"image/jpeg");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)text;
- b64b1.__size = strlen(text);
+ b64b1.set((xsd__unsignedByte *)text, strlen(text));
att->addBody(&b64b1);
att1->addBody(&b64b1);
att2->addBody(&b64b1);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachmentFault.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachmentFault.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachmentFault.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiAttachmentFault.cpp Wed Dec 14 07:06:03 2005
@@ -65,8 +65,7 @@
att2->addHeader(AXIS_CONTENT_TYPE,"image/jpeg");
att2->addHeader(AXIS_CONTENT_TRANSFER_ENCODING,"base64");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)text;
- b64b1.__size = strlen(text);
+ b64b1.set((xsd__unsignedByte *) text, strlen(text));
att->addBody(&b64b1);
att1->addBody(&b64b1);
att2->addBody(&b64b1);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiSameAttachment.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiSameAttachment.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiSameAttachment.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttMultiSameAttachment.cpp Wed Dec 14 07:06:03 2005
@@ -59,8 +59,7 @@
att2->addHeader(AXIS_CONTENT_ID,"5");
att2->addHeader(AXIS_CONTENT_TYPE,"image/jpeg");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)text;
- b64b1.__size = strlen(text);
+ b64b1.set((xsd__unsignedByte *) text, strlen(text));
att1->addBody(&b64b1);
att2->addBody(&b64b1);
//Calling webservice with multiple attachments. Here same object is passed as argument
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttNillableAttachment.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttNillableAttachment.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttNillableAttachment.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttNillableAttachment.cpp Wed Dec 14 07:06:03 2005
@@ -72,8 +72,7 @@
//Adding the content type as text/xml
att->addHeader(AXIS_CONTENT_TYPE,"text/xml");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)buffer;
- b64b1.__size = length;
+ b64b1.set((xsd__unsignedByte *) buffer, length);
att->addBody(&b64b1);
//Calling the service. Here passing NULL as argument
//Service will return the content of 'att' ie content of first argument
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainText.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainText.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainText.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainText.cpp Wed Dec 14 07:06:03 2005
@@ -58,8 +58,7 @@
//Adding the content type as text/plain
att->addHeader(AXIS_CONTENT_TYPE,"text/plain");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)text;
- b64b1.__size = strlen(text);
+ b64b1.set((xsd__unsignedByte *) text, strlen(text));
att->addBody(&b64b1);
//Calling the dataHandlerService, service will return content
Result=ws.echoText(att);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainTextSSL.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainTextSSL.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainTextSSL.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AttPlainTextSSL.cpp Wed Dec 14 07:06:03 2005
@@ -57,8 +57,7 @@
//Adding the content type as text/plain
att->addHeader(AXIS_CONTENT_TYPE,"text/plain");
xsd__base64Binary b64b1;
- b64b1.__ptr = (xsd__unsignedByte*)text;
- b64b1.__size = strlen(text);
+ b64b1.set((xsd__unsignedByte *) text, strlen(text));
att->addBody(&b64b1);
sslkeyhome=getenv("SSL_KEYS_HOME");
if (!sslkeyhome)
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/Attachment1Client.cpp Wed Dec 14 07:06:03 2005
@@ -45,8 +45,7 @@
else if (2==i)
att[i]->addHeader("Content-Disposition","checked");
- b64b[i].__ptr = (xsd__unsignedByte*)text;
- b64b[i].__size = strlen(text)+1;
+ b64b[i].set((unsigned char *)text, strlen(text)+1);
att[i]->addBody(&b64b[i]);
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBenchClient.cpp Wed Dec 14 07:06:03 2005
@@ -40,252 +40,275 @@
int main(int argc, char* argv[])
{
- AxisBench *ws;
+ AxisBench *ws;
- BenchDataType *input = NULL;
- BenchDataType *output = NULL;
- xsd__unsignedByte* buffer = NULL;
-
- char *endpoint = WSDL_DEFAULT_ENDPOINT;
- bool endpoint_set = false;
- int returnValue = 1; // Assume Failure
-
- endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
-
- bool bSuccess = false;
- int iRetryIterationCount = 3;
-
- do
- {
- try {
- if(endpoint_set) {
- ws = new AxisBench(endpoint, APTHTTP1_1);
- free(endpoint);
- endpoint_set = false;
- } else
- ws = new AxisBench();
+ BenchDataType *input = NULL;
+ BenchDataType *output = NULL;
+ xsd__unsignedByte* buffer = NULL;
-
- int request = 1;
+ char *endpoint = WSDL_DEFAULT_ENDPOINT;
+ bool endpoint_set = false;
+ int returnValue = 1; // Assume Failure
+
+ endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
+
+ do
+ {
+ try
+ {
+ if(endpoint_set)
+ {
+ ws = new AxisBench(endpoint, APTHTTP1_1);
+ free(endpoint);
+ endpoint_set = false;
+ }
+ else
+ ws = new AxisBench();
+
+ int request = 1;
- input = new BenchDataType();
- input->count = 100;
+ input = new BenchDataType();
+ input->count = 100;
-// input->infos.m_Array = new BenchBasicDataType[input->count];
- BenchBasicDataType_Array arrayIn;
- BenchBasicDataType ** ppBBDT = new BenchBasicDataType *[input->count];
+ BenchBasicDataType_Array arrayIn;
+ BenchBasicDataType ** ppBBDT = new BenchBasicDataType *[input->count];
-#ifdef WIN32
- __int64 ll = 10000;
-#else
- long long ll = 10000;
-#endif
-
-
- time_t tim;
- tim = 1100246323;
- struct tm *temp = gmtime(&tim);
- struct tm lt;
- memcpy(<, temp, sizeof(struct tm));
-
- char *letterA_String = stringToAscii("A");
- buffer = (xsd__unsignedByte*)calloc (1, input->count + 2);
-
- strcpy ( (char *)buffer, letterA_String);
-
- for ( int i = 0; i < input->count ; i++ ) {
- BenchBasicDataType *type = new BenchBasicDataType();
- type->StringType = "StringType";
- type->IntegerType = 10*(i+1);
- type->DoubleType = 11.111 * (i+1);
- type->BooleanType = true_;
- type->DateTimeType = lt ;
- type->TimeType = lt ;
- type->DateType = lt ;
- type->IntType = (i+1);
- type->ByteType = '1';
- type->DecimalType = 10*(i+1);
- type->FloatType = (float)((float)(11*(i+1))/(float)2.0);
- type->LongType = ll;
- type->QNameType = "toto";
- type->ShortType = (i+1);
- type->Base64BinaryType.__size=i;
- type->Base64BinaryType.__ptr=buffer;
- type->HexBinary.__size=i;
- type->HexBinary.__ptr=buffer;
-
- ppBBDT[i] = type;
-
- if( ll == 0)
- {
- ll = 1;
- }
- else
- {
- ll += 10000;
- }
+ xsd__long ll = 10000;
- strcat ( (char *)buffer, letterA_String);
- }
+ time_t tim;
+ tim = 1100246323;
+ struct tm *temp = gmtime(&tim);
+ struct tm lt;
+ memcpy(<, temp, sizeof(struct tm));
+
+ char *letterA_String = stringToAscii("A");
+ buffer = (xsd__unsignedByte*)calloc (1, input->count + 2);
+
+ strcpy ( (char *)buffer, letterA_String);
+
+ for ( int i = 0; i < input->count ; i++ )
+ {
+ BenchBasicDataType *type = new BenchBasicDataType();
+ type->StringType = "StringType";
+ type->IntegerType = 10*(i+1);
+ type->DoubleType = 11.111 * (i+1);
+ type->BooleanType = true_;
+ type->DateTimeType = lt ;
+ type->TimeType = lt ;
+ type->DateType = lt ;
+ type->IntType = (i+1);
+ type->ByteType = '1';
+ type->DecimalType = 10*(i+1);
+ type->FloatType = (float)((float)(11*(i+1))/(float)2.0);
+ type->LongType = ll;
+ type->QNameType = "toto";
+ type->ShortType = (i+1);
+ type->Base64BinaryType.set(buffer, i);
+ type->HexBinary.set(buffer, i);
+
+ ppBBDT[i] = type;
+
+ if( ll == 0)
+ {
+ ll = 1;
+ }
+ else
+ {
+ ll += 10000;
+ }
- int t1,t2;
+ strcat ( (char *)buffer, letterA_String);
+ }
+
+ int t1,t2;
#ifndef WIN32
- struct timeval mstart;
- struct timeval mstop;
- gettimeofday( &mstart, NULL );
+ struct timeval mstart;
+ struct timeval mstop;
+ gettimeofday( &mstart, NULL );
#else
- struct timeb mstart;
- struct timeb mstop;
- ftime(&mstart);
+ struct timeb mstart;
+ struct timeb mstop;
+ ftime(&mstart);
#endif
- arrayIn.set(ppBBDT,100);
- input->setinfos(&arrayIn);
- for ( int ii = 0; ii < request ; ii++ ) {
- if (output) { // Samisa: memory management BP
- int outputSize =0;
- BenchBasicDataType ** outArray =output->infos->get(outputSize);
- for (int i = 0; i < outputSize; i++)
- delete outArray[i];
- delete output;
- output = NULL;
- }
- output = ws->doBenchRequest(input);
- }
-
- free(buffer);
+ arrayIn.set(ppBBDT, input->count);
+ input->setinfos(&arrayIn);
+ for ( int ii = 0; ii < request ; ii++ )
+ {
+ if (output)
+ { // Samisa: memory management BP
+ int outputSize =0;
+ BenchBasicDataType ** outArray =output->infos->get(outputSize);
+ for (int i = 0; i < outputSize; i++)
+ delete outArray[i];
+ delete output;
+ output = NULL;
+ }
+ output = ws->doBenchRequest(input);
+ }
+
+ for (int count = 0 ; count < input->count ; count++ )
+ {
+ delete ppBBDT[count];
+ }
+ delete [] ppBBDT;
+ free(buffer);
#ifndef WIN32
- gettimeofday( &mstop, NULL );
- t1 = mstart.tv_sec*1000 + mstart.tv_usec/1000;
- t2 = mstop.tv_sec*1000 + mstop.tv_usec/1000;
+ gettimeofday( &mstop, NULL );
+ t1 = mstart.tv_sec*1000 + mstart.tv_usec/1000;
+ t2 = mstop.tv_sec*1000 + mstop.tv_usec/1000;
#else
- ftime(&mstop);
- t1 = mstart.time*1000 + mstart.millitm;
- t2 = mstop.time*1000 + mstop.millitm;
+ ftime(&mstop);
+ t1 = mstart.time*1000 + mstart.millitm;
+ t2 = mstop.time*1000 + mstop.millitm;
#endif
- int total = t2-t1;
-
- if ( ws->getStatus() == AXIS_FAIL )
- cout << "Failed" << endl;
- else
- {
- bSuccess = true;
- char dateTime[50];
- int i = 0;
- if ( argc > 1 )
- i = output->count -1;
-
- cout << "Input Count : " << input->count << endl;
- cout << "Count : " << output->count << endl;
- int outputSize = 0;
- BenchBasicDataType ** outArray =output->infos->get(outputSize);
- for ( ; i < output->count ; i++ )
- {
- if( outArray[i] != (BenchBasicDataType *) 0xcdcdcdcd)
- {
- cout << " ----------------------------------------------" << endl;
- cout << " StringType " << outArray[i]->StringType << endl;
- cout << " IntType " << outArray[i]->IntType << endl;
- cout << " IntegerType " << outArray[i]->IntegerType << endl;
- cout << " DoubleType " << outArray[i]->DoubleType << endl;
- cout << " BooleanType " << outArray[i]->BooleanType << endl;
- strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", &outArray[i]->DateTimeType);
- cout << " DateTimeType " << dateTime << endl;
- strftime(dateTime, 50, "%a %b %d %Y", &outArray[i]->DateType);
- cout << " DateType " << dateTime << endl;
+ int total = t2-t1;
+
+ if ( ws->getStatus() == AXIS_FAIL )
+ cout << "Failed" << endl;
+ else
+ {
+ bSuccess = true;
+ char dateTime[50];
+ int i = 0;
+ if ( argc > 1 )
+ i = output->count -1;
+
+ cout << "Input Count : " << input->count << endl;
+ cout << "Count : " << output->count << endl;
+ int outputSize = 0;
+ BenchBasicDataType ** outArray =output->infos->get(outputSize);
+ for ( ; i < output->count ; i++ )
+ {
+ if( outArray[i] != (BenchBasicDataType *) 0xcdcdcdcd)
+ {
+ cout << " ----------------------------------------------" << endl;
+ cout << " StringType " << outArray[i]->StringType << endl;
+ cout << " IntType " << outArray[i]->IntType << endl;
+ cout << " IntegerType " << outArray[i]->IntegerType << endl;
+ cout << " DoubleType " << outArray[i]->DoubleType << endl;
+ cout << " BooleanType " << outArray[i]->BooleanType << endl;
+ strftime(dateTime, 50, "%a %b %d %H:%M:%S %Y", &outArray[i]->DateTimeType);
+ cout << " DateTimeType " << dateTime << endl;
+ strftime(dateTime, 50, "%a %b %d %Y", &outArray[i]->DateType);
+ cout << " DateType " << dateTime << endl;
// This is being removed due to problem in some servers.
// See XSDTime or XSDTimeNil testcases for full validation of the xsd:time type
-// strftime(dateTime, 50, "%H:%M:%S", &output->infos.m_Array[i]->TimeType);
-// cout << " TimeType " << dateTime << endl;
+// strftime(dateTime, 50, "%H:%M:%S", &output->infos.m_Array[i]->TimeType);
+// cout << " TimeType " << dateTime << endl;
// Following check for os/400 - the mock server will return ascii char which needs to be converted
#ifdef __OS400__
- if (outArray[i]->ByteType == 0x31)
- outArray[i]->ByteType = '1';
+ if (outArray[i]->ByteType == 0x31)
+ outArray[i]->ByteType = '1';
#endif
- cout << " ByteType " << outArray[i]->ByteType << endl;
- cout << " DecimalType " << outArray[i]->DecimalType << endl;
- cout << " FloatType " << outArray[i]->FloatType << endl;
- cout << " LongType " << outArray[i]->LongType << endl;
- cout << " QNameType " << outArray[i]->QNameType << endl;
- cout << " ShortType " << outArray[i]->ShortType << endl;
-
- cout << " Base64BinaryType " << outArray[i]->Base64BinaryType.__size << endl;
- if( outArray[i]->Base64BinaryType.__size > 0)
- {
- cout << " Base64BinaryType " << asciiToString((char *)outArray[i]->Base64BinaryType.__ptr) << endl;
- }
-
- cout << " HexBinaryType " << outArray[i]->HexBinary.__size << endl;
- if( outArray[i]->HexBinary.__size > 0)
- {
- cout << " HexBinaryType " << asciiToString((char *)outArray[i]->HexBinary.__ptr) << endl;
- }
- }
- returnValue=0;
- }
- }
+ cout << " ByteType " << outArray[i]->ByteType << endl;
+ cout << " DecimalType " << outArray[i]->DecimalType << endl;
+ cout << " FloatType " << outArray[i]->FloatType << endl;
+ cout << " LongType " << outArray[i]->LongType << endl;
+ cout << " QNameType " << outArray[i]->QNameType << endl;
+ cout << " ShortType " << outArray[i]->ShortType << endl;
+
+ int size = 0;
+ xsd__unsignedByte * base64BinaryData = outArray[i]->Base64BinaryType.get(size);
+ cout << " Base64BinaryType " << size << endl;
+ if( size > 0)
+ {
+ cout << " Base64BinaryType " << asciiToString(base64BinaryData, size) << endl;
+ }
+ if (base64BinaryData != NULL)
+ {
+ delete [] base64BinaryData;
+ base64BinaryData = NULL;
+ }
+
+ size = 0;
+ xsd__unsignedByte * hexBinaryData = outArray[i]->HexBinary.get(size);
+ cout << " HexBinaryType " << size << endl;
+ if( size > 0)
+ {
+ cout << " HexBinaryType " << asciiToString((char *)hexBinaryData) << endl;
+ }
+ if (hexBinaryData != NULL)
+ {
+ delete [] hexBinaryData;
+ hexBinaryData = NULL;
+ }
+ }
+ returnValue=0;
+ }
+ }
+
+ if(verbose)
+ {
+ cout << " ----------------------------------------------" << endl;
+ cout << input->count << " input paramters, and " << request << " requests" << endl;
+ cout << "Total time = " << total << " ms" << endl;
+ cout << "Average time = " << total/request << " ms" << endl;
+ }
+ }
+ catch(AxisException &e)
+ {
+ bool bSilent = false;
+
+ if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+ {
+ if( iRetryIterationCount > 1)
+ {
+ bSilent = true;
+ }
+ }
+ else
+ {
+ iRetryIterationCount = 0;
+ }
- if(verbose) {
- cout << " ----------------------------------------------" << endl;
- cout << input->count << " input paramters, and " << request << " requests" << endl;
- cout << "Total time = " << total << " ms" << endl;
- cout << "Average time = " << total/request << " ms" << endl;
- }
- } catch(AxisException &e) {
- bool bSilent = false;
+ if( !bSilent)
+ {
+ cout << "Exception : " << e.what() << endl;
+ }
+ }
+ catch(...)
+ {
+ cerr << "Unknown Exception occured." << endl;
+ }
- if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
- {
- if( iRetryIterationCount > 1)
- {
- bSilent = true;
- }
- }
- else
- {
- iRetryIterationCount = 0;
- }
+ // Samisa: make sure we clean up memory allocated
+ try
+ {
+ delete ws;
+ delete input;
+ if (output)
+ {
+ delete output;
+ }
+ }
+ catch(AxisException& e)
+ {
+ cerr << e.what() << endl;
+ }
+ catch(exception& e)
+ {
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception on clean up: " << endl;
+ }
+ iRetryIterationCount--;
+ }
+ while( iRetryIterationCount > 0 && !bSuccess);
- if( !bSilent)
- {
- cout << "Exception : " << e.what() << endl;
- }
- } catch(...) {
- cerr << "Unknown Exception occured." << endl;
- }
-
- // Samisa: make sure we clean up memory allocated
- try
- {
- delete ws;
- delete input;
- if (output)
- {
- delete output;
- }
- }
- catch(AxisException& e)
- {
- cerr << e.what() << endl;
- }
- catch(exception& e)
- {
- cout << "Exception : " << e.what() << endl;
- }
- catch(...)
- {
- cout << "Unknown exception on clean up: " << endl;
- }
- iRetryIterationCount--;
- } while( iRetryIterationCount > 0 && !bSuccess);
if(endpoint_set)
- free(endpoint);
- cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
- return returnValue;
+ free(endpoint);
+ cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+ return returnValue;
}
/* Spin through args list and check for -e -p and -s options.
@@ -334,7 +357,7 @@
i--;
break;
case 'v':
- verbose=true;
+ verbose=true;
break;
default:
break;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/AxisBench_TTestClient.cpp Wed Dec 14 07:06:03 2005
@@ -121,10 +121,8 @@
type->LongType = ll;
type->QNameType = "toto";
type->ShortType = (i+1);
- type->Base64BinaryType.__size=i;
- type->Base64BinaryType.__ptr=buffer;
- type->HexBinary.__size=i;
- type->HexBinary.__ptr=buffer;
+ type->Base64BinaryType.set(buffer, i);
+ type->HexBinary.set(buffer, i);
ppBBDT[i] = type;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp Wed Dec 14 07:06:03 2005
@@ -171,13 +171,15 @@
printf("invoking echoBase64...\n");
xsd__base64Binary bb;
- bb.__ptr = (unsigned char*)strdup(bstr);
- bb.__size = strlen(bstr);
+ bb.set((unsigned char *) strdup(bstr), strlen(bstr));
ws.setTransportProperty("SOAPAction" , "InteropBase#echoBase64");
- if (bb.__size == ws.echoBase64(bb).__size)
+ xsd__base64Binary bbResult = ws.echoBase64(bb);
+ int size = 0;
+ const xsd__unsignedByte * data = bbResult.get(size);
+ if (bb.getSize() == size)
{
printf("successful\n");
- printf("Returned String :\n%s\n", asciiToString((char *)bb.__ptr));
+ printf("Returned String :\n%s\n", asciiToString((char *)data));
}
else
printf("failed\n");
@@ -199,13 +201,15 @@
printf("invoking echoHexBinary...\n");
xsd__hexBinary hb;
- hb.__ptr = (unsigned char*)strdup(bstr);
- hb.__size = strlen(bstr);
+ hb.set((unsigned char*)strdup(bstr), strlen(bstr));
ws.setTransportProperty("SOAPAction" , "InteropBase#echoHexBinary");
- if (hb.__size == ws.echoHexBinary(hb).__size)
+ xsd__hexBinary hbResult = ws.echoHexBinary(hb);
+ size = 0;
+ data = hbResult.get(size);
+ if (hb.getSize == size)
{
printf("successful\n");
- printf("Returned String :\n%s\n", asciiToString((char *)hb.__ptr));
+ printf("Returned String :\n%s\n", asciiToString((char *)data));
}
else
printf("failed\n");
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1DocClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1DocClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1DocClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1DocClient.cpp Wed Dec 14 07:06:03 2005
@@ -170,13 +170,15 @@
printf("invoking echoBase64...\n");
xsd__base64Binary bb;
- bb.__ptr = (unsigned char*)strdup(bstr);
- bb.__size = strlen(bstr);
+ bb.set((unsigned char*)strdup(bstr), strlen(bstr));
ws.setTransportProperty("SOAPAction" , "InteropBaseDoc#echoBase64");
- if (bb.__size == ws.echoBase64(bb).__size)
+ xsd__base64Binary bbResult = ws.echoBase64(bb);
+ int size = 0;
+ xsd__unsignedByte * data = bbResult.get(size);
+ if (bb.getSize() == size)
{
printf("successful\n");
- printf("Returned String :\n%s\n", asciiToString((char *)bb.__ptr));
+ printf("Returned String :\n%s\n", asciiToString((char *)data));
}
else
printf("failed\n");
@@ -200,13 +202,15 @@
printf("invoking echoHexBinary...\n");
xsd__hexBinary hb;
- hb.__ptr = (unsigned char*)strdup(bstr);
- hb.__size = strlen(bstr);
+ hb.set((unsigned char*)strdup(bstr), strlen(bstr));
ws.setTransportProperty("SOAPAction" , "InteropBaseDoc#echoHexBinary");
- if (hb.__size == ws.echoHexBinary(hb).__size)
+ xsd__hexBinary hbResult = ws.echoHexBinary(hb);
+ size = 0;
+ data = hbResult.get(size);
+ if (hb.getSize() == size)
{
printf("successful\n");
- printf("Returned String :\n%s\n", asciiToString((char *)hb.__ptr));
+ printf("Returned String :\n%s\n", asciiToString((char *)data));
}
else
printf("failed\n");
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDAttributeClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDAttributeClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDAttributeClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDAttributeClient.cpp Wed Dec 14 07:06:03 2005
@@ -74,10 +74,8 @@
xsd__hexBinary hexTest;
xsd__unsignedByte* testUB = (xsd__unsignedByte*)"<test><xml>some dod&y string</xml></test>";
- b64Test.__ptr=testUB;
- b64Test.__size=41;
- hexTest.__ptr=testUB;
- hexTest.__size=41;
+ b64Test.set(testUB, 41);
+ hexTest.set(testUB, 41);
time_t timeToTest;
timeToTest = 1100246323;
@@ -174,18 +172,22 @@
b64Type->base64BinaryType = b64Test;
b64TypeReturn = ws->getDataBase64Binary(b64Type);
- cout << "base64Binary size=" << b64TypeReturn->base64BinaryType.__size << endl;
- if( b64TypeReturn->base64BinaryType.__size > 0)
+ int size = 0;
+ const xsd__unsignedByte * base64BinaryData = b64TypeReturn->base64BinaryType.get(size);
+ cout << "base64Binary size=" << size << endl;
+ if( size > 0)
{
- cout << "base64Binary data=" << b64TypeReturn->base64BinaryType.__ptr << endl;
+ cout << "base64Binary data=" << base64BinaryData << endl;
}
hexType->hexBinaryType = hexTest;
hexTypeReturn = ws->getDataHexBinary(hexType);
- cout << "hexBinary size=" << hexTypeReturn->hexBinaryType.__size << endl;
- if( hexTypeReturn->hexBinaryType.__size > 0)
+ size = 0;
+ const xsd__unsignedByte * hexBinaryData = hexTypeReturn->hexBinaryType.get(size);
+ cout << "hexBinary size=" << size << endl;
+ if( size > 0)
{
- cout << "hexBinary data=" << hexTypeReturn->hexBinaryType.__ptr << endl;
+ cout << "hexBinary data=" << hexBinaryData << endl;
}
*/
bSuccess = true;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementClient.cpp Wed Dec 14 07:06:03 2005
@@ -80,10 +80,8 @@
xsd__unsignedByte* testUB = (xsd__unsignedByte*)stringToAscii("<test><xml>some dod&y string</xml></test>");
- b64Test.__ptr=testUB;
- b64Test.__size=41;
- hexTest.__ptr=testUB;
- hexTest.__size=41;
+ b64Test.set(testUB, 41);
+ hexTest.set(testUB, 41);
time_t timeToTest;
timeToTest = 1100246323;
@@ -194,17 +192,21 @@
printf("decimal=%.5f\n", decResult); fflush(stdout);
b64Result = ws->setGetBase64BinaryType(b64Test);
- cout << "base64Binary size=" << b64Result.__size << endl;
- if( b64Result.__size > 0)
+ int size = 0;
+ const xsd__unsignedByte * base64BinaryData = b64Result.get(size);
+ cout << "base64Binary size=" << size << endl;
+ if( size > 0)
{
- cout << "base64Binary data=" << asciiToStringOfLength((char *)b64Result.__ptr, b64Result.__size) << endl;
+ cout << "base64Binary data=" << asciiToStringOfLength((char *)base64BinaryData, size) << endl;
}
hexResult = ws->setGetHexBinary(hexTest);
- cout << "hexBinary size=" << hexResult.__size << endl;
- if( hexResult.__size > 0)
+ size = 0;
+ const xsd__unsignedByte * hexBinaryData = hexResult.get(size);
+ cout << "hexBinary size=" << size << endl;
+ if( size > 0)
{
- cout << "hexBinary data=" << asciiToStringOfLength((char *)hexResult.__ptr, hexResult.__size) << endl;
+ cout << "hexBinary data=" << asciiToStringOfLength((char *)hexBinaryData, size) << endl;
}
bSuccess = true;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSDElementNilClient.cpp Wed Dec 14 07:06:03 2005
@@ -102,10 +102,8 @@
xsd__unsignedByte* testUB = (xsd__unsignedByte*)stringToAscii("<test><xml>some dod&y string</xml></test>");
- b64Test.__ptr=testUB;
- b64Test.__size=41;
- hexTest.__ptr=testUB;
- hexTest.__size=41;
+ b64Test.set(testUB, 41);
+ hexTest.set(testUB, 41);
time_t timeToTest;
timeToTest = 1100246323;
@@ -275,26 +273,30 @@
cout << "decimal nil=NULL" << endl;
b64Result = ws->setGetBase64BinaryType(&b64Test);
- cout << "base64Binary size=" << b64Result->__size << endl;
- if( b64Result->__size > 0)
+ int size = 0;
+ const xsd__unsignedByte * base64BinaryData = b64Result->get(size);
+ cout << "base64Binary size=" << size << endl;
+ if( size > 0)
{
- cout << "base64Binary data=" << asciiToStringOfLength((char *)b64Result->__ptr, b64Result->__size) << endl;
+ cout << "base64Binary data=" << asciiToStringOfLength((char *)base64BinaryData, size) << endl;
}
b64Result = ws->setGetBase64BinaryType(NULL);
if(b64Result)
- cout << "base64Binary nil size=" << b64Result->__size << endl;
+ cout << "base64Binary nil size=" << b64Result->getSize() << endl;
else
cout << "base64Binary nil=NULL" << endl;
hexResult = ws->setGetHexBinary(&hexTest);
- cout << "hexBinary size=" << hexResult->__size << endl;
- if( hexResult->__size > 0)
+ size = 0;
+ const xsd__unsignedByte * hexBinaryData = hexResult->get(size);
+ cout << "hexBinary size=" << size << endl;
+ if( size > 0)
{
- cout << "hexBinary data=" << asciiToStringOfLength((char *)hexResult->__ptr, hexResult->__size) << endl;
+ cout << "hexBinary data=" << asciiToStringOfLength((char *)hexBinaryData, size) << endl;
}
hexResult = ws->setGetHexBinary(&hexTest);
if(hexResult)
- cout << "hexBinary nil size=" << hexResult->__size << endl;
+ cout << "hexBinary nil size=" << hexResult->getSize() << endl;
else
cout << "hexBinary nil=NULL" << endl;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64Binary2Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64Binary2Client.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64Binary2Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64Binary2Client.cpp Wed Dec 14 07:06:03 2005
@@ -35,16 +35,17 @@
sprintf(endpoint, "%s", url);
XSD_base64Binary* ws = new XSD_base64Binary(endpoint);
- xsd__base64Binary input;
- xsd__unsignedByte* testUB = (xsd__unsignedByte*)" <test><xml> some dod&y string </xml></test> ";
- input.__ptr=testUB;
- input.__size=100;
+ xsd__base64Binary input;
+ xsd__unsignedByte* testUB = (xsd__unsignedByte*)" <test><xml> some dod&y string </xml></test> ";
+ input.set(testUB, 100);
// Test non-nillable element
- xsd__base64Binary result = ws->asNonNillableElement(input);
+ xsd__base64Binary result = ws->asNonNillableElement(input);
+ int size = 0;
+ const xsd__unsignedByte * data = result.get(size);
cout << "non-nillable element" << endl;
- cout << " size=" << result.__size << endl;
- cout << " data=" << result.__ptr << endl;
+ cout << " size=" << size << endl;
+ cout << " data=" << data << endl;
delete ws;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryAttributeClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryAttributeClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryAttributeClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryAttributeClient.cpp Wed Dec 14 07:06:03 2005
@@ -40,16 +40,17 @@
xsd__unsignedByte* testUB = (xsd__unsignedByte*)stringToAscii("<test><xml>some dod&y string</xml></test>");
- input.__ptr=testUB;
- input.__size=41;
-
+ int.set(testUB, 41);
+
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
requiredAttributeInput.setrequiredAttribute(input);
RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
cout << "required attribute" << endl;
- cout << " size=" << requiredAttributeResult->getrequiredAttribute().__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)requiredAttributeResult->getrequiredAttribute().__ptr, requiredAttributeResult->getrequiredAttribute().__size) << endl;
+ int size = 0;
+ const xsd__unsignedByte * base64BinaryData = requiredAttributeResult->getrequiredAttribute().get(size);
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *)base64BinaryData, size) << endl;
delete requiredAttributeResult;
// Test now complete
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryClient.cpp Wed Dec 14 07:06:03 2005
@@ -40,14 +40,15 @@
xsd__unsignedByte* testUB = (xsd__unsignedByte*)stringToAscii("<test><xml>some dod&y string</xml></test>");
- input.__ptr=testUB;
- input.__size=41;
+ input.set(testUB, 41);
// Test non-nillable element
xsd__base64Binary result = ws->asNonNillableElement(input);
+ int size = 0;
+ const xsd__unsignedByte * resultData = result.get(size);
cout << "non-nillable element" << endl;
- cout << " size=" << result.__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)result.__ptr, result.__size) << endl;
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *)resultData, size) << endl;
// Test nillable element, with a value
xsd__base64Binary* nillableInput = new xsd__base64Binary();
@@ -56,8 +57,10 @@
if (nillableResult)
{
cout << "nillable element" << endl;
- cout << " size=" << nillableResult->__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)nillableResult->__ptr, nillableResult->__size) << endl;
+ size = 0;
+ const xsd__unsignedByte * data = nillableResult->get(size);
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *)data, size) << endl;
delete nillableResult;
}
else
@@ -70,60 +73,18 @@
nillableResult = ws->asNillableElement(NULL);
if (nillableResult)
{
- cout << "nillable element=" << endl;
- cout << " size=" << nillableResult->__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)nillableResult->__ptr, nillableResult->__size) << endl;
- delete nillableResult;
- }
+ cout << "nillable element" << endl;
+ size = 0;
+ const xsd__unsignedByte * data = nillableResult->get(size);
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *)data, size) << endl;
+ delete nillableResult;
+ }
else
{
cout << "nil element=<nil>" << endl;
}
- // Test required attribute
- /* RequiredAttributeElement requiredAttributeInput;
-
- requiredAttributeInput.setrequiredAttribute(input);
- RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
- cout << "required attribute" << endl;
- cout << " size=" << requiredAttributeResult->getrequiredAttribute().__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)requiredAttributeResult->getrequiredAttribute().__ptr, requiredAttributeResult->getrequiredAttribute().__size) << endl;
- delete requiredAttributeResult; */
-
-/* Optional Attributes currently unsupported by WSDL2Ws
- * Exact coding of this section may change depending on chosen implementation
- // Test optional attribute, with a value
- OptionalAttributeElement optionalAttributeInput;
- optionalAttributeInput.setoptionalAttribute(input);
- OptionalAttributeElement* optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
- if (optionalAttributeResult->getoptionalAttribute())
- {
- cout << "optional attribute, with data" << endl;
- cout << " size=" << optionalAttributeResult->getoptionalAttribute()->__size << endl;
- cout << " data=" << optionalAttributeResult->getoptionalAttribute()->__ptr << endl;
- }
- else
- {
- cout << "optional attribute, with data=<not present>" << endl;
- }
- delete optionalAttributeResult;
-
- // Test optional attribute, not present
- optionalAttributeInput.setattribute();
- optionalAttributeResult = ws->asOptionalAttribute(&optionalAttributeInput);
- if (optionalAttributeResult->getoptionalAttribute())
- {
- cout << "optional attribute, not present" << endl;
- cout << " size=" << optionalAttributeResult->getoptionalAttribute()->__size << endl;
- cout << " data=" << optionalAttributeResult->getoptionalAttribute()->__ptr << endl;
- }
- else
- {
- cout << "optional attribute, not present=<not present>" << endl;
- }
- delete optionalAttributeResult;
-*/
-
// Test array
xsd__base64Binary_Array arrayInput;
int arraySize=2;
@@ -139,9 +100,11 @@
cout << "array of " << outputSize << " elements" << endl;
for (int index = 0; index < outputSize ; index++)
{
+ size = 0;
+ const xsd__unsignedByte * data = output[index]->get(size);
cout << " element[" << index << "]" << endl;
- cout << " size=" << output[index]->__size << endl;
- cout << " data=" << asciiToStringOfLength((char *) output[index]->__ptr, output[index]->__size) << endl;
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *) data, size) << endl;
}
for (int deleteIndex = 0 ; deleteIndex < arraySize ; deleteIndex++ )
@@ -154,9 +117,11 @@
SimpleComplexType complexTypeInput;
complexTypeInput.setcomplexTypeElement(input);
SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
+ size = 0;
+ const xsd__unsignedByte * data = complexTypeResult->getcomplexTypeElement().get(size);
cout << "within complex type" << endl;
- cout << " size=" << complexTypeResult->getcomplexTypeElement().__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)complexTypeResult->getcomplexTypeElement().__ptr, complexTypeResult->getcomplexTypeElement().__size) << endl;
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *)data, size) << endl;
delete complexTypeResult;
// Tests now complete
Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryTestValidDataClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryTestValidDataClient.cpp?rev=356787&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryTestValidDataClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_base64BinaryTestValidDataClient.cpp Wed Dec 14 07:06:03 2005
@@ -0,0 +1,133 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+
+#include "XSD_base64Binary.hpp"
+#include <axis/AxisException.hpp>
+#include <ctype.h>
+#include <iostream>
+#include "CommonClientTestCode.hpp"
+
+
+int main(int argc, char* argv[])
+{
+ char endpoint[256];
+ const char* url="http://localhost:80/axis/XSD_base64Binary";
+
+ if(argc>1)
+ url = argv[1];
+
+ // bool bSuccess = false;
+
+ try
+ {
+ int count = 0;
+ sprintf(endpoint, "%s", url);
+ XSD_base64Binary* ws = new XSD_base64Binary(endpoint);
+
+ xsd__base64Binary input;
+
+ xsd__unsignedByte binaryStream[] = {255, 1, 254, 2, 127, 0};
+
+ xsd__unsignedByte* testUB = binaryStream;
+
+ input.set(testUB, 6);
+
+ // Test complex type
+ SimpleComplexType complexTypeInput;
+ complexTypeInput.setcomplexTypeElement(input);
+ SimpleComplexType* complexTypeResult = ws->asComplexType(&complexTypeInput);
+ cout << "within received complex type" << endl;
+ xsd__base64Binary complexTypeElement = complexTypeResult->getcomplexTypeElement();
+ int size = 0;
+ const xsd__unsignedByte * data = complexTypeElement.get(size);
+ cout << " size = " << size << endl;
+ cout << " data = { ";
+ for (count = 0 ; count < size ; count ++)
+ {
+ if (count != 0)
+ {
+ cout << ", ";
+ }
+ cout << (unsigned int) data[count];
+ }
+ cout << " }" << endl;
+
+
+ delete ws;
+
+ // Check if everything is there after deleting the web service
+ cout << "within received complex type after deleting web service" << endl;
+ cout << " size = " << size << endl;
+ cout << " data = { ";
+ for (count = 0 ; count < size ; count ++)
+ {
+ if (count != 0)
+ {
+ cout << ", ";
+ }
+ cout << (unsigned int) data[count];
+ }
+ cout << " }" << endl;
+
+ // Re-run the web service, to try and ensure it blats anything it's going to blat
+ ws = new XSD_base64Binary(endpoint);
+
+ xsd__unsignedByte binaryStream2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 254, 253, 252, 251, 250};
+
+ testUB = binaryStream2;
+
+ input.set(testUB, 16);
+
+ // Test complex type
+ complexTypeInput.setcomplexTypeElement(input);
+ SimpleComplexType* complexTypeResult2 = ws->asComplexType(&complexTypeInput);
+
+ // Check if everything is there after re-creating and invoking web service
+ cout << "within received complex type after re-creating and invoking web service" << endl;
+ cout << " size = " << size << endl;
+ cout << " data = { ";
+ for (count = 0 ; count < size ; count ++)
+ {
+ if (count != 0)
+ {
+ cout << ", ";
+ }
+ cout << (unsigned int) data[count];
+ }
+ cout << " }" << endl;
+
+ delete ws;
+ delete complexTypeResult2;
+ delete complexTypeResult;
+ }
+ catch(AxisException& e)
+ {
+ cout << "Exception : " << e.what() << endl;
+ }
+ catch(exception& e)
+ {
+ cout << "Unknown exception has occured: " << e.what() << endl;
+ }
+ catch(...)
+ {
+ cout << "Unknown exception has occured" << endl;
+ }
+
+ cout<< "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+ return 0;
+}
+
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryAttributeClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryAttributeClient.cpp?rev=356787&r1=356786&r2=356787&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryAttributeClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/XSD_hexBinaryAttributeClient.cpp Wed Dec 14 07:06:03 2005
@@ -38,16 +38,17 @@
xsd__unsignedByte* testUB = (xsd__unsignedByte*)stringToAscii("<test><xml>some dod&y string</xml></test>");
- input.__ptr=testUB;
- input.__size=41;
+ input.set(testUB, 41);
// Test required attribute
RequiredAttributeElement requiredAttributeInput;
requiredAttributeInput.setrequiredAttribute(input);
RequiredAttributeElement* requiredAttributeResult = ws->asRequiredAttribute(&requiredAttributeInput);
cout << "required attribute" << endl;
- cout << " size=" << requiredAttributeResult->getrequiredAttribute().__size << endl;
- cout << " data=" << asciiToStringOfLength((char *)requiredAttributeResult->getrequiredAttribute().__ptr, requiredAttributeResult->getrequiredAttribute().__size) << endl;
+ int size = 0;
+ const xsd__unsignedByte * data = requireAttributeResult->getrequiredAttribute().get();
+ cout << " size=" << size << endl;
+ cout << " data=" << asciiToStringOfLength((char *)data, size) << endl;
delete requiredAttributeResult;
// Tests now complete