You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2005/01/21 16:06:56 UTC
cvs commit: ws-axis/c/src/soap/xsd/constraints MaxLength.cpp MaxLength.hpp MinLength.cpp MinLength.hpp
dicka 2005/01/21 07:06:56
Modified: c/src/soap Makefile.am
c/src/soap/xsd AnyURI.cpp AnyURI.hpp Base64Binary.cpp
Base64Binary.hpp HexBinary.cpp HexBinary.hpp
NOTATION.cpp NOTATION.hpp String.cpp String.hpp
XSD_QName.cpp XSD_QName.hpp
c/vc AxisClientDLL.dsp AxisServerDLL.dsp
Added: c/src/soap/xsd/constraints MaxLength.cpp MaxLength.hpp
MinLength.cpp MinLength.hpp
Log:
Adding constraint validation/processing to XSD SOAP objects. Addition of MinLength and MaxLength constraints.
Submitted by: Adrian Dick
Revision Changes Path
1.17 +3 -1 ws-axis/c/src/soap/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Makefile.am 20 Jan 2005 09:51:23 -0000 1.16
+++ Makefile.am 21 Jan 2005 15:06:56 -0000 1.17
@@ -40,7 +40,9 @@
xsd/Time.cpp \
xsd/XSD_QName.cpp \
xsd/constraints/WhiteSpace.cpp \
- xsd/constraints/Pattern.cpp
+ xsd/constraints/Pattern.cpp \
+ xsd/constraints/MinLength.cpp \
+ xsd/constraints/MaxLength.cpp
libsoap_la_LIBADD = $(LDFLAGS)
INCLUDES = -I../../include
1.4 +52 -0 ws-axis/c/src/soap/xsd/AnyURI.cpp
Index: AnyURI.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/AnyURI.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AnyURI.cpp 20 Jan 2005 09:51:23 -0000 1.3
+++ AnyURI.cpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -18,6 +18,48 @@
AxisChar* AnyURI::serialize(const AxisChar* value) throw (AxisSoapException)
{
+ MinLength* minLength= getMinLength();
+ if (minLength->isSet())
+ {
+ if (strlen(value) < minLength->getMinLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", minLength->getMinLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete minLength;
+
+ MaxLength* maxLength = getMaxLength();
+ if (maxLength->isSet())
+ {
+ if (strlen(value) > maxLength->getMaxLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", maxLength->getMaxLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxLength;
+
AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
@@ -41,6 +83,16 @@
WhiteSpace* AnyURI::getWhiteSpace()
{
return new WhiteSpace(REPLACE);
+ }
+
+ MinLength* AnyURI::getMinLength()
+ {
+ return new MinLength();
+ }
+
+ MaxLength* AnyURI::getMaxLength()
+ {
+ return new MaxLength();
}
AXIS_CPP_NAMESPACE_END
1.4 +17 -0 ws-axis/c/src/soap/xsd/AnyURI.hpp
Index: AnyURI.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/AnyURI.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AnyURI.hpp 20 Jan 2005 09:51:23 -0000 1.3
+++ AnyURI.hpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -23,6 +23,8 @@
#define _ANYURI_HPP____OF_AXIS_INCLUDED_
#include "IAnySimpleType.hpp"
+#include "constraints/MinLength.hpp"
+#include "constraints/MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
@@ -71,6 +73,21 @@
* @return WhiteSpace object set to replace whitespace
*/
WhiteSpace* getWhiteSpace();
+
+ /**
+ * Creates a minLength object, used to allocate storage. By default the AnyURI
+ * object does not have this specified, so this is an unset minLength object.
+ * @return An unset MinLength object
+ */
+ MinLength* getMinLength();
+
+ /**
+ * Creates a maxLength object, used to allocate storage. By default the AnyURI
+ * object does not have this specified, so this is an unset maxLength object.
+ * @return An unset MaxLength object
+ */
+ MaxLength* getMaxLength();
+
private:
AxisChar* m_AnyURI;
1.6 +53 -0 ws-axis/c/src/soap/xsd/Base64Binary.cpp
Index: Base64Binary.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Base64Binary.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Base64Binary.cpp 20 Jan 2005 09:51:23 -0000 1.5
+++ Base64Binary.cpp 21 Jan 2005 15:06:56 -0000 1.6
@@ -27,6 +27,49 @@
AxisChar* Base64Binary::serialize(const xsd__base64Binary* value) throw (AxisSoapException)
{
+ MinLength* minLength= getMinLength();
+ if (minLength->isSet())
+ {
+ if (value->__size < minLength->getMinLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", minLength->getMinLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", value->__size);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+
+ }
+ delete minLength;
+
+ MaxLength* maxLength = getMaxLength();
+ if (maxLength->isSet())
+ {
+ if (value->__size > maxLength->getMaxLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", maxLength->getMaxLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", value->__size);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxLength;
+
int len = apr_base64_encode_len (value->__size);
AxisChar* serializedValue = new AxisChar[len + 1];
len = apr_base64_encode_binary (serializedValue, value->__ptr, value->__size);
@@ -54,6 +97,16 @@
m_Base64Binary->__ptr[m_Base64Binary->__size] = 0;
return m_Base64Binary;
+ }
+
+ MinLength* Base64Binary::getMinLength()
+ {
+ return new MinLength();
+ }
+
+ MaxLength* Base64Binary::getMaxLength()
+ {
+ return new MaxLength();
}
AXIS_CPP_NAMESPACE_END
1.5 +18 -0 ws-axis/c/src/soap/xsd/Base64Binary.hpp
Index: Base64Binary.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/Base64Binary.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Base64Binary.hpp 20 Jan 2005 04:19:00 -0000 1.4
+++ Base64Binary.hpp 21 Jan 2005 15:06:56 -0000 1.5
@@ -25,6 +25,8 @@
#include "IAnySimpleType.hpp"
#include "../apr_base64.h"
#include <axis/AxisUserAPI.hpp>
+#include "constraints/MinLength.hpp"
+#include "constraints/MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
@@ -70,6 +72,22 @@
* @return Deserialized Base64Binary value.
*/
xsd__base64Binary* deserializeBase64Binary(const AxisChar* valueAsChar) throw (AxisSoapException);
+
+protected:
+
+ /**
+ * Creates a minLength object, used to allocate storage. By default the Base64Binary
+ * object does not have this specified, so this is an unset minLength object.
+ * @return An unset MinLength object
+ */
+ MinLength* getMinLength();
+
+ /**
+ * Creates a maxLength object, used to allocate storage. By default the Base64Binary
+ * object does not have this specified, so this is an unset maxLength object.
+ * @return An unset MaxLength object
+ */
+ MaxLength* getMaxLength();
private:
xsd__base64Binary* m_Base64Binary;
1.8 +52 -0 ws-axis/c/src/soap/xsd/HexBinary.cpp
Index: HexBinary.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/HexBinary.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- HexBinary.cpp 20 Jan 2005 09:51:23 -0000 1.7
+++ HexBinary.cpp 21 Jan 2005 15:06:56 -0000 1.8
@@ -27,6 +27,48 @@
AxisChar* HexBinary::serialize(const xsd__hexBinary* value) throw (AxisSoapException)
{
+ MinLength* minLength= getMinLength();
+ if (minLength->isSet())
+ {
+ if (value->__size < minLength->getMinLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", minLength->getMinLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", value->__size);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete minLength;
+
+ MaxLength* maxLength = getMaxLength();
+ if (maxLength->isSet())
+ {
+ if (value->__size > maxLength->getMaxLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", maxLength->getMaxLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", value->__size);
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxLength;
+
char* serializedValue = new char[value->__size * 2 + 1];
Hex_Encode (serializedValue, value->__ptr, value->__size);
serializedValue[value->__size * 2] = 0;
@@ -54,6 +96,16 @@
m_HexBinary->__ptr[m_HexBinary->__size] = 0;
return m_HexBinary;
+ }
+
+ MinLength* HexBinary::getMinLength()
+ {
+ return new MinLength();
+ }
+
+ MaxLength* HexBinary::getMaxLength()
+ {
+ return new MaxLength();
}
AXIS_CPP_NAMESPACE_END
1.5 +18 -0 ws-axis/c/src/soap/xsd/HexBinary.hpp
Index: HexBinary.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/HexBinary.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HexBinary.hpp 20 Jan 2005 04:49:29 -0000 1.4
+++ HexBinary.hpp 21 Jan 2005 15:06:56 -0000 1.5
@@ -25,6 +25,8 @@
#include "IAnySimpleType.hpp"
#include <axis/AxisUserAPI.hpp>
#include "../HexCoder.h"
+#include "constraints/MinLength.hpp"
+#include "constraints/MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
@@ -70,6 +72,22 @@
* @return Deserialized HexBinary value.
*/
xsd__hexBinary* deserializeHexBinary(const AxisChar* valueAsChar) throw (AxisSoapException);
+
+protected:
+
+ /**
+ * Creates a minLength object, used to allocate storage. By default the HexBinary
+ * object does not have this specified, so this is an unset minLength object.
+ * @return An unset MinLength object
+ */
+ MinLength* getMinLength();
+
+ /**
+ * Creates a maxLength object, used to allocate storage. By default the HexBinary
+ * object does not have this specified, so this is an unset maxLength object.
+ * @return An unset MaxLength object
+ */
+ MaxLength* getMaxLength();
private:
xsd__hexBinary* m_HexBinary;
1.4 +52 -0 ws-axis/c/src/soap/xsd/NOTATION.cpp
Index: NOTATION.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NOTATION.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NOTATION.cpp 20 Jan 2005 09:51:23 -0000 1.3
+++ NOTATION.cpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -18,6 +18,48 @@
AxisChar* NOTATION::serialize(const AxisChar* value) throw (AxisSoapException)
{
+ MinLength* minLength= getMinLength();
+ if (minLength->isSet())
+ {
+ if (strlen(value) < minLength->getMinLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", minLength->getMinLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete minLength;
+
+ MaxLength* maxLength = getMaxLength();
+ if (maxLength->isSet())
+ {
+ if (strlen(value) > maxLength->getMaxLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", maxLength->getMaxLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxLength;
+
AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
@@ -40,6 +82,16 @@
WhiteSpace* NOTATION::getWhiteSpace()
{
return new WhiteSpace(REPLACE);
+}
+
+MinLength* NOTATION::getMinLength()
+{
+ return new MinLength();
+}
+
+MaxLength* NOTATION::getMaxLength()
+{
+ return new MaxLength();
}
AXIS_CPP_NAMESPACE_END
1.4 +17 -0 ws-axis/c/src/soap/xsd/NOTATION.hpp
Index: NOTATION.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/NOTATION.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NOTATION.hpp 20 Jan 2005 09:51:23 -0000 1.3
+++ NOTATION.hpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -23,6 +23,8 @@
#define _NOTATION_HPP____OF_AXIS_INCLUDED_
#include "IAnySimpleType.hpp"
+#include "constraints/MinLength.hpp"
+#include "constraints/MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
@@ -71,6 +73,21 @@
* @return WhiteSpace object set to replace whitespace
*/
WhiteSpace* getWhiteSpace();
+
+ /**
+ * Creates a minLength object, used to allocate storage. By default the NOTATION
+ * object does not have this specified, so this is an unset minLength object.
+ * @return An unset MinLength object
+ */
+ MinLength* getMinLength();
+
+ /**
+ * Creates a maxLength object, used to allocate storage. By default the NOTATION
+ * object does not have this specified, so this is an unset maxLength object.
+ * @return An unset MaxLength object
+ */
+ MaxLength* getMaxLength();
+
private:
AxisChar* m_NOTATION;
1.4 +52 -0 ws-axis/c/src/soap/xsd/String.cpp
Index: String.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/String.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- String.cpp 20 Jan 2005 09:51:23 -0000 1.3
+++ String.cpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -18,6 +18,48 @@
AxisChar* String::serialize(const AxisChar* value) throw (AxisSoapException)
{
+ MinLength* minLength= getMinLength();
+ if (minLength->isSet())
+ {
+ if (strlen(value) < minLength->getMinLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", minLength->getMinLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete minLength;
+
+ MaxLength* maxLength = getMaxLength();
+ if (maxLength->isSet())
+ {
+ if (strlen(value) > maxLength->getMaxLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", maxLength->getMaxLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxLength;
+
AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
@@ -35,6 +77,16 @@
m_String = new char[strlen (valueAsChar) + 1];
strcpy (m_String, valueAsChar);
return m_String;
+}
+
+MinLength* String::getMinLength()
+{
+ return new MinLength();
+}
+
+MaxLength* String::getMaxLength()
+{
+ return new MaxLength();
}
AXIS_CPP_NAMESPACE_END
1.4 +18 -0 ws-axis/c/src/soap/xsd/String.hpp
Index: String.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/String.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- String.hpp 20 Jan 2005 09:51:23 -0000 1.3
+++ String.hpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -23,6 +23,8 @@
#define _STRING_HPP____OF_AXIS_INCLUDED_
#include "IAnySimpleType.hpp"
+#include "constraints/MinLength.hpp"
+#include "constraints/MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
@@ -63,6 +65,22 @@
* @return Deserialized String value.
*/
AxisChar* deserializeString(const AxisChar* valueAsChar) throw (AxisSoapException);
+
+protected:
+
+ /**
+ * Creates a minLength object, used to allocate storage. By default the String
+ * object does not have this specified, so this is an unset minLength object.
+ * @return An unset MinLength object
+ */
+ MinLength* getMinLength();
+
+ /**
+ * Creates a maxLength object, used to allocate storage. By default the String
+ * object does not have this specified, so this is an unset maxLength object.
+ * @return An unset MaxLength object
+ */
+ MaxLength* getMaxLength();
private:
AxisChar* m_String;
1.4 +52 -0 ws-axis/c/src/soap/xsd/XSD_QName.cpp
Index: XSD_QName.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/XSD_QName.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSD_QName.cpp 20 Jan 2005 09:51:23 -0000 1.3
+++ XSD_QName.cpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -18,6 +18,48 @@
AxisChar* XSD_QName::serialize(const AxisChar* value) throw (AxisSoapException)
{
+ MinLength* minLength= getMinLength();
+ if (minLength->isSet())
+ {
+ if (strlen(value) < minLength->getMinLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is shorter than MinLength specified for this type. Minlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", minLength->getMinLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete minLength;
+
+ MaxLength* maxLength = getMaxLength();
+ if (maxLength->isSet())
+ {
+ if (strlen(value) > maxLength->getMaxLength())
+ {
+ AxisString exceptionMessage =
+ "Length of value to be serialized is longer than MaxLength specified for this type. Maxlength = ";
+ AxisChar* length = new AxisChar[10];
+ sprintf(length, "%d", maxLength->getMaxLength());
+ exceptionMessage += length;
+ exceptionMessage += ", Length of value = ";
+ sprintf(length, "%d", strlen(value));
+ exceptionMessage += length;
+ exceptionMessage += ".";
+
+ throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
+ const_cast<AxisChar*>(exceptionMessage.c_str()));
+ }
+ }
+ delete maxLength;
+
AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
@@ -36,5 +78,15 @@
{
return new WhiteSpace(COLLAPSE);
}
+
+ MinLength* XSD_QName::getMinLength()
+ {
+ return new MinLength();
+ }
+
+ MaxLength* XSD_QName::getMaxLength()
+ {
+ return new MaxLength();
+ }
AXIS_CPP_NAMESPACE_END
1.4 +17 -0 ws-axis/c/src/soap/xsd/XSD_QName.hpp
Index: XSD_QName.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/soap/xsd/XSD_QName.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSD_QName.hpp 20 Jan 2005 09:51:23 -0000 1.3
+++ XSD_QName.hpp 21 Jan 2005 15:06:56 -0000 1.4
@@ -23,6 +23,8 @@
#define _QNAME_HPP____OF_AXIS_INCLUDED_
#include "IAnySimpleType.hpp"
+#include "constraints/MinLength.hpp"
+#include "constraints/MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
@@ -71,6 +73,21 @@
* @return WhiteSpace object set to collapse whitespace
*/
WhiteSpace* getWhiteSpace();
+
+ /**
+ * Creates a minLength object, used to allocate storage. By default the QName
+ * object does not have this specified, so this is an unset minLength object.
+ * @return An unset MinLength object
+ */
+ MinLength* getMinLength();
+
+ /**
+ * Creates a maxLength object, used to allocate storage. By default the QName
+ * object does not have this specified, so this is an unset maxLength object.
+ * @return An unset MaxLength object
+ */
+ MaxLength* getMaxLength();
+
private:
AxisChar* m_QName;
1.28 +8 -0 ws-axis/c/vc/AxisClientDLL.dsp
Index: AxisClientDLL.dsp
===================================================================
RCS file: /home/cvs/ws-axis/c/vc/AxisClientDLL.dsp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- AxisClientDLL.dsp 20 Jan 2005 09:51:27 -0000 1.27
+++ AxisClientDLL.dsp 21 Jan 2005 15:06:56 -0000 1.28
@@ -286,7 +286,15 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\constraints\MaxLength.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\common\MessageData.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\soap\xsd\constraints\MinLength.cpp
# End Source File
# Begin Source File
1.27 +8 -0 ws-axis/c/vc/AxisServerDLL.dsp
Index: AxisServerDLL.dsp
===================================================================
RCS file: /home/cvs/ws-axis/c/vc/AxisServerDLL.dsp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- AxisServerDLL.dsp 21 Jan 2005 12:29:15 -0000 1.26
+++ AxisServerDLL.dsp 21 Jan 2005 15:06:56 -0000 1.27
@@ -282,7 +282,15 @@
# End Source File
# Begin Source File
+SOURCE=..\src\soap\xsd\constraints\MaxLength.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\src\common\MessageData.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\soap\xsd\constraints\MinLength.cpp
# End Source File
# Begin Source File
1.1 ws-axis/c/src/soap/xsd/constraints/MaxLength.cpp
Index: MaxLength.cpp
===================================================================
#include "MaxLength.hpp"
AXIS_CPP_NAMESPACE_START
MaxLength::MaxLength():m_MaxLength(0)
{
m_isSet = false;
}
MaxLength::MaxLength(int maxLength)
{
m_MaxLength = maxLength;
m_isSet = true;
}
int MaxLength::getMaxLength()
{
return m_MaxLength;
}
bool MaxLength::isSet()
{
return m_isSet;
}
AXIS_CPP_NAMESPACE_END
1.1 ws-axis/c/src/soap/xsd/constraints/MaxLength.hpp
Index: MaxLength.hpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* 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.
*/
/*
* @file MaxLength.hpp
*/
#if !defined(_MAXLENGTH_HPP____OF_AXIS_INCLUDED_)
#define _MAXLENGTH_HPP____OF_AXIS_INCLUDED_
#include "IConstrainingFacet.hpp"
AXIS_CPP_NAMESPACE_START
/**
* @class MaxLength
*
* @author Adrian Dick (adrian.dick@uk.ibm.com)
*
*/
class MaxLength : IConstrainingFacet {
public:
MaxLength();
MaxLength(int maxLength);
int getMaxLength();
bool isSet();
private:
int m_MaxLength;
};
AXIS_CPP_NAMESPACE_END
#endif
1.1 ws-axis/c/src/soap/xsd/constraints/MinLength.cpp
Index: MinLength.cpp
===================================================================
#include "MinLength.hpp"
AXIS_CPP_NAMESPACE_START
MinLength::MinLength():m_MinLength(0)
{
m_isSet = false;
}
MinLength::MinLength(int minLength)
{
m_MinLength = minLength;
m_isSet = true;
}
int MinLength::getMinLength()
{
return m_MinLength;
}
bool MinLength::isSet()
{
return m_isSet;
}
AXIS_CPP_NAMESPACE_END
1.1 ws-axis/c/src/soap/xsd/constraints/MinLength.hpp
Index: MinLength.hpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* 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.
*/
/*
* @file MinLength.hpp
*/
#if !defined(_MINLENGTH_HPP____OF_AXIS_INCLUDED_)
#define _MINLENGTH_HPP____OF_AXIS_INCLUDED_
#include "IConstrainingFacet.hpp"
AXIS_CPP_NAMESPACE_START
/**
* @class MinLength
*
* @author Adrian Dick (adrian.dick@uk.ibm.com)
*
*/
class MinLength : IConstrainingFacet {
public:
MinLength();
MinLength(int minLength);
int getMinLength();
bool isSet();
private:
int m_MinLength;
};
AXIS_CPP_NAMESPACE_END
#endif