You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Michael Xiong (JIRA)" <ax...@ws.apache.org> on 2006/05/19 17:10:31 UTC

[jira] Created: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
-------------------------------------------------------------------------------------------------------------------------------

         Key: AXISCPP-970
         URL: http://issues.apache.org/jira/browse/AXISCPP-970
     Project: Axis-C++
        Type: Bug

  Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types  
    Versions:  1.6 Beta    
 Environment:   	    Platform:
        Linux fedora 3.0
Axis version:
        Server-side Axis C++ 1.6Beta
XML Parser Lib:
xersesc 2.6
WSDL2ws tool by using axis java 1.3
Client-side version Axis java 1.3
Http Server Version:
Apache 2.0.53
Tomcat 2.0.58
    Reporter: Michael Xiong
    Priority: Critical


 [Introduction]: 
Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
I found that axis-c-1.6beta has taken some improvement on this area, it's good.
But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
This problem occurred in nearly all XSD types.
The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".

 [Error Statement]: 
The below is a piece of WSDL which used by me:
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
<TestingResponse xmlns="... ...">;
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
</TestingResponse>

I wrote the related code logic(demo purpose only) in server module is like the below:
xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
{
//<mxiong debug 2006/5/19
	xsd__string_Array* pIDs = new xsd__string_Array();
	xsd__string* p = new xsd__string[3];
       p[0] = strdup("");
	p[1] = strdup("");
	p[2] = strdup("");
	pIDs->set(p,3);	
	return pIDs;
//>mxiong debug 2006/5/19
}

You can found that the response xsi:nil="true" is wrong.
That will cause my client application rejecting to accept this response for it does not follow contracted schema.

[My Solution]: 
After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
My modification is like the below:
String::String(const xsd__string value)
{
	#ifdef ENABLE_AXISTRACE
		if (axiscpp::AxisTrace::isTraceOn())
			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
	#endif

//<mxiong debug 2006/5/19
//        if (value)
//        {
            setNil(false);
            serialize(value);
//        }
//>mxiong debug 2006/5/19
	{
		#ifdef ENABLE_AXISTRACE
			if (axiscpp::AxisTrace::isTraceOn())
				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
		#endif
		return;
	}
}

AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
{
	#ifdef ENABLE_AXISTRACE
		if (axiscpp::AxisTrace::isTraceOn())
			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
	#endif

    MinLength* minLength= getMinLength();
//<mxiong debug 2006/5/19
	unsigned int nLen = 0;		
//>mxiong debug 2006/5/19
    if (minLength->isSet())
    {
//<mxiong debug 2006/5/19
	if (NULL != value)
	{
		nLen = strlen(value);
	}		
        if (nLen < (unsigned int) minLength->getMinLength())
//>mxiong debug 2006/5/19
//        if (strlen(value) < (unsigned int) 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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete minLength;
    
    MaxLength* maxLength = getMaxLength();
    if (maxLength->isSet())
    {
//<mxiong debug 2006/5/19
//        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
        if (nLen > (unsigned int) maxLength->getMaxLength())
//>mxiong debug 2006/5/19
        {
            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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete maxLength;
    Length* length = getLength();
    if (length->isSet())
    {
//<mxiong debug 2006/5/19
        if (nLen != (unsigned int) length->getLength())
//>mxiong debug 2006/5/19
//        if (strlen(value) != (unsigned int) length->getLength())
        {
            AxisString exceptionMessage =
            "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
            AxisChar* lengthAsString = new AxisChar[10];
            sprintf(lengthAsString, "%d", length->getLength());
            exceptionMessage += lengthAsString;
            exceptionMessage += ", Length of value = ";
            sprintf(lengthAsString, "%d", strlen(value));
            exceptionMessage += lengthAsString;
            exceptionMessage += ".";
            delete [] lengthAsString;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete length;

//<mxiong debug 2006/5/19 
	AxisString valueAsString;
	if (NULL != value)
	{
		valueAsString = value;
	} else
	{
		valueAsString = "";
	}
//>mxiong debug 2006/5/19
//	AxisString valueAsString = value;
	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
    IAnySimpleType::serialize(serializedValue);
    	{
		#ifdef ENABLE_AXISTRACE
			AxisChar* traceRet = (m_Buf);
			if (axiscpp::AxisTrace::isTraceOn())
				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
			return traceRet;
		#else
			return m_Buf;
		#endif
	}

}

So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.

[Suggestion]
Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "nadir amra (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXISCPP-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nadir amra updated AXISCPP-970:
-------------------------------

    Comment: was deleted

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: https://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "nadir amra (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXISCPP-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nadir amra updated AXISCPP-970:
-------------------------------

    Comment: was deleted

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: https://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "Michael Xiong (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-970?page=comments#action_12413057 ] 

Michael Xiong commented on AXISCPP-970:
---------------------------------------

Sorry,

> For a perfect solution, the change of detail design of axis-c-1.6beta in "nillable" area(both WSDL2WS and axis-c engine should be changed for related part). 

should be

For a perfect solution, the change of detail design of axis-c-1.6beta in "nillable" area(both WSDL2WS and axis-c engine should be changed for related part) is necessary. 

Thank you!
Michael Xiong

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-970
>          URL: http://issues.apache.org/jira/browse/AXISCPP-970
>      Project: Axis-C++
>         Type: Bug

>   Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>     Versions:  1.6 Beta
>  Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>     Reporter: Michael Xiong
>     Priority: Critical

>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "Michael Xiong (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-970?page=comments#action_12413054 ] 

Michael Xiong commented on AXISCPP-970:
---------------------------------------

> My code modification may be regarded as a candidate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

In order to help you to understand my suggestion more clear, I'd like to give some more comment or discussion as the below:

I think the key-point which lead this "nillable" prlblem in axis-c-1.6beta is directed from the different understanding to the related W3C standard between us:
1. What's the meaning of "nillable" attribute of element?
2. How to deal with "nillable" attribute?
3. Especially how to deal with nillable="false" together with minOccurs="0" ?

I found that in axis-c-1.6beta, not only the WSDL2WS generated code framework, but also the axis-c engine, all are judging "nillable" setting(whether "true") according to the element's value content(whether it's NULL).
That's what I don't agree to. My opinion is that "nillable" attribute should be judged according to related SCHEMA definition, NOT only from the run-time value content. 

In  my sample schema(refer to the below),  it should allow nillable="false" together with minOccurs="0".
... ...
                <xs:element name="Testing">
					<xs:complexType>
						<xs:sequence>
							<xs:choice maxOccurs="unbounded">
								<xs:element name=" Testing 1" type="xs:string"/>
								<xs:element name=" Testing 2" type="xs:string"/>
								<xs:element name=" Testing 3" type="xs:string"/>
							</xs:choice>
						</xs:sequence>
					</xs:complexType>
				</xs:element>... ...
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

My current simple fix to this problem is  for verify-purpose only, which does not change the detail design of axis-c-1.6beta, so it's NOT perfect, I think.
For a perfect solution, the change of detail design of axis-c-1.6beta in "nillable" area(both WSDL2WS and axis-c engine should be changed for related part).

Maybe my above comment may help you to clarify this problem.
Any different opinion, please feel free to discuss with me!

Thank you!
Michael Xiong

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-970
>          URL: http://issues.apache.org/jira/browse/AXISCPP-970
>      Project: Axis-C++
>         Type: Bug

>   Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>     Versions:  1.6 Beta
>  Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>     Reporter: Michael Xiong
>     Priority: Critical

>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "Michael Xiong (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-970?page=comments#action_12412660 ] 

Michael Xiong commented on AXISCPP-970:
---------------------------------------

//Sorry, the previous one still has some minor points not clear and correct, so please follow the below version:
//This one is the newest version
//change point: (mainly in my demo code: p[2] = strdup(""); --> p[2] = strdup("2");)

 [Introduction]:
Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
I found that axis-c-1.6beta has taken some improvement on this area, it's good.
But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
This problem occurred in nearly all XSD types.
The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".

 [Error Statement]:
The below is a piece of WSDL which used by me:
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

I created server code by axis-c-1.6beta on this WSDL, wrote the related code logic(demo purpose only) inside server module like the below:
xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)
{
//<mxiong debug 2006/5/19
xsd__string_Array* pIDs = new xsd__string_Array();
xsd__string* p = new xsd__string[3];
p[0] = strdup("");
p[1] = strdup("");
p[2] = strdup("2");
pIDs->set(p,3);
return pIDs;
//>mxiong debug 2006/5/19
}

I build my server module and run, ***TESTING IT BY A CLIENT APPLICATION WHICH SPEAK THE SAME WSDL***, the response looks like this:
... ...
<TestingResponse xmlns="... ...">;
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
<testcase>2</testcase>
</TestingResponse>
... ...


You can found that the response xsi:nil="true" is wrong.(because my schema does not allow xsi:nil="true", my schema means xsi:nil="false" indeed for it's the default setting according to W3C's standard )
That will cause my client application to decline the response since it does not follow contracted schema.

[My Solution]:
After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
The correct response looks like the below:
... ...
<TestingResponse xmlns="... ...">;
<testcase></testcase>
<testcase></testcase>
<testcase>2</testcase>
</TestingResponse>
... ...

Thus my client application can accept the response correctly and succeed to complete the whole session.

My detail modification is like the below:
String::String(const xsd__string value)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

//<mxiong debug 2006/5/19
// if (value)
// {
            setNil(false);
            serialize(value);
// }
//>mxiong debug 2006/5/19
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "String", this, 0); /* AUTOINSERTED TRACE */
#endif
return;
}
}

AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

    MinLength* minLength= getMinLength();
//<mxiong debug 2006/5/19
unsigned int nLen = 0;
//>mxiong debug 2006/5/19
    if (minLength->isSet())
    {
//<mxiong debug 2006/5/19
if (NULL != value)
{
nLen = strlen(value);
}
        if (nLen < (unsigned int) minLength->getMinLength())
//>mxiong debug 2006/5/19
// if (strlen(value) < (unsigned int) 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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete minLength;
    
    MaxLength* maxLength = getMaxLength();
    if (maxLength->isSet())
    {
//<mxiong debug 2006/5/19
// if (strlen(value) > (unsigned int) maxLength->getMaxLength())
        if (nLen > (unsigned int) maxLength->getMaxLength())
//>mxiong debug 2006/5/19
        {
            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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete maxLength;
    Length* length = getLength();
    if (length->isSet())
    {
//<mxiong debug 2006/5/19
        if (nLen != (unsigned int) length->getLength())
//>mxiong debug 2006/5/19
// if (strlen(value) != (unsigned int) length->getLength())
        {
            AxisString exceptionMessage =
            "Length of value to be serialized is not the same as Length specified for this type. Length = ";
            AxisChar* lengthAsString = new AxisChar[10];
            sprintf(lengthAsString, "%d", length->getLength());
            exceptionMessage += lengthAsString;
            exceptionMessage += ", Length of value = ";
            sprintf(lengthAsString, "%d", strlen(value));
            exceptionMessage += lengthAsString;
            exceptionMessage += ".";
            delete [] lengthAsString;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete length;

//<mxiong debug 2006/5/19
AxisString valueAsString;
if (NULL != value)
{
valueAsString = value;
} else
{
valueAsString = "";
}
//>mxiong debug 2006/5/19
// AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
    IAnySimpleType::serialize(serializedValue);
     {
#ifdef ENABLE_AXISTRACE
AxisChar* traceRet = (m_Buf);
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
TRACETYPE_STRING, 0, ((void*)&traceRet)); /* AUTOINSERTED TRACE */
return traceRet;
#else
return m_Buf;
#endif
}

}

So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly all the XSD types, especially for String type(but not only for String type, but also other types) as my sample indicated.

[My Suggestion]
Would you like to give it a careful check to correct this problem in axis-c-1.6beta?
My code modification may be regarded as a candicate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-970
>          URL: http://issues.apache.org/jira/browse/AXISCPP-970
>      Project: Axis-C++
>         Type: Bug

>   Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>     Versions:  1.6 Beta
>  Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>     Reporter: Michael Xiong
>     Priority: Critical

>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "Michael Xiong (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-970?page=comments#action_12437992 ] 
            
Michael Xiong commented on AXISCPP-970:
---------------------------------------

Dear all,

Environment:
Tomcat 2.0.58 should be -->
Tomcat 5.0.28

Could someboday help me to update the "Environment:" info ?

Thanks a lot !
Michael Xiong

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: http://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "nadir amra (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXISCPP-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nadir amra updated AXISCPP-970:
-------------------------------

    Comment: was deleted

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: https://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]:
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]:
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> I created server code by axis-c-1.6beta on this WSDL, wrote the related code logic(demo purpose only) inside server module like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)
> {
> //<mxiong debug 2006/5/19
> xsd__string_Array* pIDs = new xsd__string_Array();
> xsd__string* p = new xsd__string[3];
> p[0] = strdup("");
> p[1] = strdup("");
> p[2] = strdup("2");
> pIDs->set(p,3);
> return pIDs;
> //>mxiong debug 2006/5/19
> }
> I build my server module and run, ***TESTING IT BY A CLIENT APPLICATION WHICH SPEAK THE SAME WSDL***, the response looks like this:
> ... ...
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase>2</testcase>
> </TestingResponse>
> ... ...
> You can found that the response xsi:nil="true" is wrong.(because my schema does not allow xsi:nil="true", my schema means xsi:nil="false" indeed for it's the default setting according to W3C's standard )
> That will cause my client application to decline the response since it does not follow contracted schema.
> [My Solution]:
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> The correct response looks like the below:
> ... ...
> <TestingResponse xmlns="... ...">;
> <testcase></testcase>
> <testcase></testcase>
> <testcase>2</testcase>
> </TestingResponse>
> ... ...
> Thus my client application can accept the response correctly and succeed to complete the whole session.
> My detail modification is like the below:
> String::String(const xsd__string value)
> {
> #ifdef ENABLE_AXISTRACE
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
> #endif
> //<mxiong debug 2006/5/19
> // if (value)
> // {
>             setNil(false);
>             serialize(value);
> // }
> //>mxiong debug 2006/5/19
> {
> #ifdef ENABLE_AXISTRACE
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceExit("String", "String", this, 0); /* AUTOINSERTED TRACE */
> #endif
> return;
> }
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> #ifdef ENABLE_AXISTRACE
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
> #endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> unsigned int nLen = 0;
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> if (NULL != value)
> {
> nLen = strlen(value);
> }
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> // if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> // if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> // if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type. Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19
> AxisString valueAsString;
> if (NULL != value)
> {
> valueAsString = value;
> } else
> {
> valueAsString = "";
> }
> //>mxiong debug 2006/5/19
> // AxisString valueAsString = value;
> AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>      {
> #ifdef ENABLE_AXISTRACE
> AxisChar* traceRet = (m_Buf);
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> TRACETYPE_STRING, 0, ((void*)&traceRet)); /* AUTOINSERTED TRACE */
> return traceRet;
> #else
> return m_Buf;
> #endif
> }
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly all the XSD types, especially for String type(but not only for String type, but also other types) as my sample indicated.
> [My Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta?
> My code modification may be regarded as a candicate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "nadir amra (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXISCPP-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nadir amra updated AXISCPP-970:
-------------------------------

    Description: 
 [Introduction]:
Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
I found that axis-c-1.6beta has taken some improvement on this area, it's good.
But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
This problem occurred in nearly all XSD types.
The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".

 [Error Statement]:
The below is a piece of WSDL which used by me:
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

I created server code by axis-c-1.6beta on this WSDL, wrote the related code logic(demo purpose only) inside server module like the below:
xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)
{
//<mxiong debug 2006/5/19
xsd__string_Array* pIDs = new xsd__string_Array();
xsd__string* p = new xsd__string[3];
p[0] = strdup("");
p[1] = strdup("");
p[2] = strdup("2");
pIDs->set(p,3);
return pIDs;
//>mxiong debug 2006/5/19
}

I build my server module and run, ***TESTING IT BY A CLIENT APPLICATION WHICH SPEAK THE SAME WSDL***, the response looks like this:
... ...
<TestingResponse xmlns="... ...">;
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
<testcase>2</testcase>
</TestingResponse>
... ...


You can found that the response xsi:nil="true" is wrong.(because my schema does not allow xsi:nil="true", my schema means xsi:nil="false" indeed for it's the default setting according to W3C's standard )
That will cause my client application to decline the response since it does not follow contracted schema.

[My Solution]:
After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
The correct response looks like the below:
... ...
<TestingResponse xmlns="... ...">;
<testcase></testcase>
<testcase></testcase>
<testcase>2</testcase>
</TestingResponse>
... ...

Thus my client application can accept the response correctly and succeed to complete the whole session.

My detail modification is like the below:
String::String(const xsd__string value)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

//<mxiong debug 2006/5/19
// if (value)
// {
            setNil(false);
            serialize(value);
// }
//>mxiong debug 2006/5/19
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "String", this, 0); /* AUTOINSERTED TRACE */
#endif
return;
}
}

AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

    MinLength* minLength= getMinLength();
//<mxiong debug 2006/5/19
unsigned int nLen = 0;
//>mxiong debug 2006/5/19
    if (minLength->isSet())
    {
//<mxiong debug 2006/5/19
if (NULL != value)
{
nLen = strlen(value);
}
        if (nLen < (unsigned int) minLength->getMinLength())
//>mxiong debug 2006/5/19
// if (strlen(value) < (unsigned int) 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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete minLength;
    
    MaxLength* maxLength = getMaxLength();
    if (maxLength->isSet())
    {
//<mxiong debug 2006/5/19
// if (strlen(value) > (unsigned int) maxLength->getMaxLength())
        if (nLen > (unsigned int) maxLength->getMaxLength())
//>mxiong debug 2006/5/19
        {
            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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete maxLength;
    Length* length = getLength();
    if (length->isSet())
    {
//<mxiong debug 2006/5/19
        if (nLen != (unsigned int) length->getLength())
//>mxiong debug 2006/5/19
// if (strlen(value) != (unsigned int) length->getLength())
        {
            AxisString exceptionMessage =
            "Length of value to be serialized is not the same as Length specified for this type. Length = ";
            AxisChar* lengthAsString = new AxisChar[10];
            sprintf(lengthAsString, "%d", length->getLength());
            exceptionMessage += lengthAsString;
            exceptionMessage += ", Length of value = ";
            sprintf(lengthAsString, "%d", strlen(value));
            exceptionMessage += lengthAsString;
            exceptionMessage += ".";
            delete [] lengthAsString;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete length;

//<mxiong debug 2006/5/19
AxisString valueAsString;
if (NULL != value)
{
valueAsString = value;
} else
{
valueAsString = "";
}
//>mxiong debug 2006/5/19
// AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
    IAnySimpleType::serialize(serializedValue);
     {
#ifdef ENABLE_AXISTRACE
AxisChar* traceRet = (m_Buf);
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
TRACETYPE_STRING, 0, ((void*)&traceRet)); /* AUTOINSERTED TRACE */
return traceRet;
#else
return m_Buf;
#endif
}

}

So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly all the XSD types, especially for String type(but not only for String type, but also other types) as my sample indicated.

[My Suggestion]
Would you like to give it a careful check to correct this problem in axis-c-1.6beta?
My code modification may be regarded as a candicate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

  was:
 [Introduction]: 
Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
I found that axis-c-1.6beta has taken some improvement on this area, it's good.
But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
This problem occurred in nearly all XSD types.
The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".

 [Error Statement]: 
The below is a piece of WSDL which used by me:
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
<TestingResponse xmlns="... ...">;
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
</TestingResponse>

I wrote the related code logic(demo purpose only) in server module is like the below:
xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
{
//<mxiong debug 2006/5/19
	xsd__string_Array* pIDs = new xsd__string_Array();
	xsd__string* p = new xsd__string[3];
       p[0] = strdup("");
	p[1] = strdup("");
	p[2] = strdup("");
	pIDs->set(p,3);	
	return pIDs;
//>mxiong debug 2006/5/19
}

You can found that the response xsi:nil="true" is wrong.
That will cause my client application rejecting to accept this response for it does not follow contracted schema.

[My Solution]: 
After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
My modification is like the below:
String::String(const xsd__string value)
{
	#ifdef ENABLE_AXISTRACE
		if (axiscpp::AxisTrace::isTraceOn())
			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
	#endif

//<mxiong debug 2006/5/19
//        if (value)
//        {
            setNil(false);
            serialize(value);
//        }
//>mxiong debug 2006/5/19
	{
		#ifdef ENABLE_AXISTRACE
			if (axiscpp::AxisTrace::isTraceOn())
				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
		#endif
		return;
	}
}

AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
{
	#ifdef ENABLE_AXISTRACE
		if (axiscpp::AxisTrace::isTraceOn())
			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
	#endif

    MinLength* minLength= getMinLength();
//<mxiong debug 2006/5/19
	unsigned int nLen = 0;		
//>mxiong debug 2006/5/19
    if (minLength->isSet())
    {
//<mxiong debug 2006/5/19
	if (NULL != value)
	{
		nLen = strlen(value);
	}		
        if (nLen < (unsigned int) minLength->getMinLength())
//>mxiong debug 2006/5/19
//        if (strlen(value) < (unsigned int) 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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete minLength;
    
    MaxLength* maxLength = getMaxLength();
    if (maxLength->isSet())
    {
//<mxiong debug 2006/5/19
//        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
        if (nLen > (unsigned int) maxLength->getMaxLength())
//>mxiong debug 2006/5/19
        {
            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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete maxLength;
    Length* length = getLength();
    if (length->isSet())
    {
//<mxiong debug 2006/5/19
        if (nLen != (unsigned int) length->getLength())
//>mxiong debug 2006/5/19
//        if (strlen(value) != (unsigned int) length->getLength())
        {
            AxisString exceptionMessage =
            "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
            AxisChar* lengthAsString = new AxisChar[10];
            sprintf(lengthAsString, "%d", length->getLength());
            exceptionMessage += lengthAsString;
            exceptionMessage += ", Length of value = ";
            sprintf(lengthAsString, "%d", strlen(value));
            exceptionMessage += lengthAsString;
            exceptionMessage += ".";
            delete [] lengthAsString;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete length;

//<mxiong debug 2006/5/19 
	AxisString valueAsString;
	if (NULL != value)
	{
		valueAsString = value;
	} else
	{
		valueAsString = "";
	}
//>mxiong debug 2006/5/19
//	AxisString valueAsString = value;
	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
    IAnySimpleType::serialize(serializedValue);
    	{
		#ifdef ENABLE_AXISTRACE
			AxisChar* traceRet = (m_Buf);
			if (axiscpp::AxisTrace::isTraceOn())
				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
			return traceRet;
		#else
			return m_Buf;
		#endif
	}

}

So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.

[Suggestion]
Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.


> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: https://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]:
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]:
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> I created server code by axis-c-1.6beta on this WSDL, wrote the related code logic(demo purpose only) inside server module like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)
> {
> //<mxiong debug 2006/5/19
> xsd__string_Array* pIDs = new xsd__string_Array();
> xsd__string* p = new xsd__string[3];
> p[0] = strdup("");
> p[1] = strdup("");
> p[2] = strdup("2");
> pIDs->set(p,3);
> return pIDs;
> //>mxiong debug 2006/5/19
> }
> I build my server module and run, ***TESTING IT BY A CLIENT APPLICATION WHICH SPEAK THE SAME WSDL***, the response looks like this:
> ... ...
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase>2</testcase>
> </TestingResponse>
> ... ...
> You can found that the response xsi:nil="true" is wrong.(because my schema does not allow xsi:nil="true", my schema means xsi:nil="false" indeed for it's the default setting according to W3C's standard )
> That will cause my client application to decline the response since it does not follow contracted schema.
> [My Solution]:
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> The correct response looks like the below:
> ... ...
> <TestingResponse xmlns="... ...">;
> <testcase></testcase>
> <testcase></testcase>
> <testcase>2</testcase>
> </TestingResponse>
> ... ...
> Thus my client application can accept the response correctly and succeed to complete the whole session.
> My detail modification is like the below:
> String::String(const xsd__string value)
> {
> #ifdef ENABLE_AXISTRACE
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
> #endif
> //<mxiong debug 2006/5/19
> // if (value)
> // {
>             setNil(false);
>             serialize(value);
> // }
> //>mxiong debug 2006/5/19
> {
> #ifdef ENABLE_AXISTRACE
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceExit("String", "String", this, 0); /* AUTOINSERTED TRACE */
> #endif
> return;
> }
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> #ifdef ENABLE_AXISTRACE
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
> #endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> unsigned int nLen = 0;
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> if (NULL != value)
> {
> nLen = strlen(value);
> }
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> // if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> // if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> // if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type. Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19
> AxisString valueAsString;
> if (NULL != value)
> {
> valueAsString = value;
> } else
> {
> valueAsString = "";
> }
> //>mxiong debug 2006/5/19
> // AxisString valueAsString = value;
> AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>      {
> #ifdef ENABLE_AXISTRACE
> AxisChar* traceRet = (m_Buf);
> if (axiscpp::AxisTrace::isTraceOn())
> axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> TRACETYPE_STRING, 0, ((void*)&traceRet)); /* AUTOINSERTED TRACE */
> return traceRet;
> #else
> return m_Buf;
> #endif
> }
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly all the XSD types, especially for String type(but not only for String type, but also other types) as my sample indicated.
> [My Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta?
> My code modification may be regarded as a candicate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "nadir amra (JIRA)" <ax...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/AXISCPP-970?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nadir amra updated AXISCPP-970:
-------------------------------

    Comment: was deleted

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: https://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "Michael Xiong (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-970?page=comments#action_12412618 ] 

Michael Xiong commented on AXISCPP-970:
---------------------------------------

//Sorry, the previous one is still has some minor points not clear and correct, so please follow the below version:
//change point: (mainly in my demo code: p[2] = strdup(""); --> p[2] = strdup("2");)

 [Introduction]:
Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
I found that axis-c-1.6beta has taken some improvement on this area, it's good.
But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
This problem occurred in nearly all XSD types.
The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".

 [Error Statement]:
The below is a piece of WSDL which used by me:
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

I created server code by axis-c-1.6beta on this WSDL, wrote the related code logic(demo purpose only) inside server module like the below:
xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)
{
//<mxiong debug 2006/5/19
xsd__string_Array* pIDs = new xsd__string_Array();
xsd__string* p = new xsd__string[3];
p[0] = strdup("");
p[1] = strdup("");
p[2] = strdup("2");
pIDs->set(p,3);
return pIDs;
//>mxiong debug 2006/5/19
}

I build my server module and run, ***TESTING IT BY A CLIENT APPLICATION WHICH SPEAK THE SAME WSDL***, the response looks like this:
... ...
<TestingResponse xmlns="... ...">;
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true">2</testcase>
</TestingResponse>
... ...


You can found that the response xsi:nil="true" is wrong.(because my schema does not allow xsi:nil="true", my schema means xsi:nil="false" indeed for it's the default setting according to W3C's standard )
That will cause my client application to decline the response since it does not follow contracted schema.

[My Solution]:
After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
The correct response looks like the below:
... ...
<TestingResponse xmlns="... ...">;
<testcase></testcase>
<testcase></testcase>
<testcase>2</testcase>
</TestingResponse>
... ...

Thus my client application can accept the response correctly and succeed to complete the whole session.

My detail modification is like the below:
String::String(const xsd__string value)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

//<mxiong debug 2006/5/19
// if (value)
// {
            setNil(false);
            serialize(value);
// }
//>mxiong debug 2006/5/19
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "String", this, 0); /* AUTOINSERTED TRACE */
#endif
return;
}
}

AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

    MinLength* minLength= getMinLength();
//<mxiong debug 2006/5/19
unsigned int nLen = 0;
//>mxiong debug 2006/5/19
    if (minLength->isSet())
    {
//<mxiong debug 2006/5/19
if (NULL != value)
{
nLen = strlen(value);
}
        if (nLen < (unsigned int) minLength->getMinLength())
//>mxiong debug 2006/5/19
// if (strlen(value) < (unsigned int) 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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete minLength;
    
    MaxLength* maxLength = getMaxLength();
    if (maxLength->isSet())
    {
//<mxiong debug 2006/5/19
// if (strlen(value) > (unsigned int) maxLength->getMaxLength())
        if (nLen > (unsigned int) maxLength->getMaxLength())
//>mxiong debug 2006/5/19
        {
            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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete maxLength;
    Length* length = getLength();
    if (length->isSet())
    {
//<mxiong debug 2006/5/19
        if (nLen != (unsigned int) length->getLength())
//>mxiong debug 2006/5/19
// if (strlen(value) != (unsigned int) length->getLength())
        {
            AxisString exceptionMessage =
            "Length of value to be serialized is not the same as Length specified for this type. Length = ";
            AxisChar* lengthAsString = new AxisChar[10];
            sprintf(lengthAsString, "%d", length->getLength());
            exceptionMessage += lengthAsString;
            exceptionMessage += ", Length of value = ";
            sprintf(lengthAsString, "%d", strlen(value));
            exceptionMessage += lengthAsString;
            exceptionMessage += ".";
            delete [] lengthAsString;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete length;

//<mxiong debug 2006/5/19
AxisString valueAsString;
if (NULL != value)
{
valueAsString = value;
} else
{
valueAsString = "";
}
//>mxiong debug 2006/5/19
// AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
    IAnySimpleType::serialize(serializedValue);
     {
#ifdef ENABLE_AXISTRACE
AxisChar* traceRet = (m_Buf);
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
TRACETYPE_STRING, 0, ((void*)&traceRet)); /* AUTOINSERTED TRACE */
return traceRet;
#else
return m_Buf;
#endif
}

}

So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly all the XSD types, especially for String type(but not only for String type, but also other types) as my sample indicated.

[My Suggestion]
Would you like to give it a careful check to correct this problem in axis-c-1.6beta?
My code modification may be regarded as a candicate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-970
>          URL: http://issues.apache.org/jira/browse/AXISCPP-970
>      Project: Axis-C++
>         Type: Bug

>   Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>     Versions:  1.6 Beta
>  Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>     Reporter: Michael Xiong
>     Priority: Critical

>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "Michael Xiong (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-970?page=comments#action_12412617 ] 

Michael Xiong commented on AXISCPP-970:
---------------------------------------

//Sorry, there're some poinnts in-corrent in above content, so I'd like to rewite it as the below(would you like to help me to update the description as the below?):

 [Introduction]:
Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
I found that axis-c-1.6beta has taken some improvement on this area, it's good.
But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
This problem occurred in nearly all XSD types.
The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".

 [Error Statement]:
The below is a piece of WSDL which used by me:
... ...
<xs:element name="TestingResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
... ...

I created server code by axis-c-1.6beta on this WSDL, wrote the related code logic(demo purpose only) inside server module like the below:
xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)
{
//<mxiong debug 2006/5/19
xsd__string_Array* pIDs = new xsd__string_Array();
xsd__string* p = new xsd__string[3];
       p[0] = strdup("");
p[1] = strdup("");
p[2] = strdup("");
pIDs->set(p,3);
return pIDs;
//>mxiong debug 2006/5/19
}

I build my server module and run, ***TESTING IT BY A CLIENT APPLICATION WHICH SPEAK THE SAME WSDL***, the response looks like this:
... ...
<TestingResponse xmlns="... ...">;
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true"></testcase>
<testcase xsi:nil="true">2</testcase>
</TestingResponse>
... ...


You can found that the response xsi:nil="true" is wrong.(because my schema does not allow xsi:nil="true", my schema means xsi:nil="false" indeed for it's the default setting according to W3C's standard )
That will cause my client application to decline the response since it does not follow contracted schema.

[My Solution]:
After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
The correct response looks like the below:
... ...
<TestingResponse xmlns="... ...">;
<testcase></testcase>
<testcase></testcase>
<testcase>2</testcase>
</TestingResponse>
... ...

Thus my client application can accept the response correctly and succeed to complete the whole session.

My detail modification is like the below:
String::String(const xsd__string value)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

//<mxiong debug 2006/5/19
// if (value)
// {
            setNil(false);
            serialize(value);
// }
//>mxiong debug 2006/5/19
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "String", this, 0); /* AUTOINSERTED TRACE */
#endif
return;
}
}

AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
{
#ifdef ENABLE_AXISTRACE
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */
#endif

    MinLength* minLength= getMinLength();
//<mxiong debug 2006/5/19
unsigned int nLen = 0;
//>mxiong debug 2006/5/19
    if (minLength->isSet())
    {
//<mxiong debug 2006/5/19
if (NULL != value)
{
nLen = strlen(value);
}
        if (nLen < (unsigned int) minLength->getMinLength())
//>mxiong debug 2006/5/19
// if (strlen(value) < (unsigned int) 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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete minLength;
    
    MaxLength* maxLength = getMaxLength();
    if (maxLength->isSet())
    {
//<mxiong debug 2006/5/19
// if (strlen(value) > (unsigned int) maxLength->getMaxLength())
        if (nLen > (unsigned int) maxLength->getMaxLength())
//>mxiong debug 2006/5/19
        {
            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 += ".";
            delete [] length;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete maxLength;
    Length* length = getLength();
    if (length->isSet())
    {
//<mxiong debug 2006/5/19
        if (nLen != (unsigned int) length->getLength())
//>mxiong debug 2006/5/19
// if (strlen(value) != (unsigned int) length->getLength())
        {
            AxisString exceptionMessage =
            "Length of value to be serialized is not the same as Length specified for this type. Length = ";
            AxisChar* lengthAsString = new AxisChar[10];
            sprintf(lengthAsString, "%d", length->getLength());
            exceptionMessage += lengthAsString;
            exceptionMessage += ", Length of value = ";
            sprintf(lengthAsString, "%d", strlen(value));
            exceptionMessage += lengthAsString;
            exceptionMessage += ".";
            delete [] lengthAsString;
            
            throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
                const_cast<AxisChar*>(exceptionMessage.c_str()));
        }
    }
    delete length;

//<mxiong debug 2006/5/19
AxisString valueAsString;
if (NULL != value)
{
valueAsString = value;
} else
{
valueAsString = "";
}
//>mxiong debug 2006/5/19
// AxisString valueAsString = value;
AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
    IAnySimpleType::serialize(serializedValue);
     {
#ifdef ENABLE_AXISTRACE
AxisChar* traceRet = (m_Buf);
if (axiscpp::AxisTrace::isTraceOn())
axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
TRACETYPE_STRING, 0, ((void*)&traceRet)); /* AUTOINSERTED TRACE */
return traceRet;
#else
return m_Buf;
#endif
}

}

So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly all the XSD types, especially for String type(but not only for String type, but also other types) as my sample indicated.

[My Suggestion]
Would you like to give it a careful check to correct this problem in axis-c-1.6beta?
My code modification may be regarded as a candicate solution for you to resolve this problem, but I think there may has some better detail design for axis-c-1.6beta on "nillable" area.

> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-970
>          URL: http://issues.apache.org/jira/browse/AXISCPP-970
>      Project: Axis-C++
>         Type: Bug

>   Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>     Versions:  1.6 Beta
>  Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>     Reporter: Michael Xiong
>     Priority: Critical

>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (AXISCPP-970) axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard

Posted by "nadir amra (JIRA)" <ax...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/AXISCPP-970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598810#action_12598810 ] 

nadir amra commented on AXISCPP-970:
------------------------------------

For a truly optional element, one that is allowed to be absent altogether, minoccurs="0" is what you want.  Nillable
means that the element can be present without its normal content, provided that xsi:nil="true" is one of its attributes.

So basically if minoccures=0, then element can be absent from XML document. 

More information: http://www.ibm.com/developerworks/xml/library/ws-tip-null.html



> axis-c engine: nillable problem: when minOccurs="0" and nillable="false", the serailization does NOT follow W3C schema standard
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXISCPP-970
>                 URL: https://issues.apache.org/jira/browse/AXISCPP-970
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Serialization, Server - Apache module, Server - Engine, SOAP, XSD Types
>    Affects Versions:  1.6 Beta
>         Environment:   	    Platform:
>         Linux fedora 3.0
> Axis version:
>         Server-side Axis C++ 1.6Beta
> XML Parser Lib:
> xersesc 2.6
> WSDL2ws tool by using axis java 1.3
> Client-side version Axis java 1.3
> Http Server Version:
> Apache 2.0.53
> Tomcat 2.0.58
>            Reporter: Michael Xiong
>            Priority: Critical
>
>  [Introduction]: 
> Maybe you have known that, the axis-c-1.5final's "nillable" dealing is completely wrong.
> I found that axis-c-1.6beta has taken some improvement on this area, it's good.
> But after really verify axis-c-1.6beta, I found axis-c-1.6beta seems has NOT resolved the old nillable issue correctly.
> At first, the design of "nillable" is too strange and hard-for-maintain in axis-c-1.6beta.
> The W3C's standard set default of "nillable" to "false", but axis-c-1.6beta set it's default to "true" in related constructor.
> Anyway, if axis-c-1.6beta can deal with "nillable" carefully & correctly in inner logic, there will has no problem.
> But after verify, I found that axis-c-1.6beta seems does not deal with "nillable" correctly in case of minOccurs="0".
> This problem occurred in nearly all XSD types.
> The below is a sample which has been verified by me, which indicate that axis-c-1.6beta has problem to deal with "nillable" in case of minOccurs="0".
>  [Error Statement]: 
> The below is a piece of WSDL which used by me:
> ... ...
> <xs:element name="TestingResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" maxOccurs="unbounded" name="testcase" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> ... ...
> When I create server code by axis-c-1.6beta on this WSDL, build it and run, the response looks like this:
> <TestingResponse xmlns="... ...">;
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> <testcase xsi:nil="true"></testcase>
> </TestingResponse>
> I wrote the related code logic(demo purpose only) in server module is like the below:
> xsd__string_Array * MyTesting::Testing(xsd__string Value0,xsd__string Value1,xsd__string Value2)  
> {
> //<mxiong debug 2006/5/19
> 	xsd__string_Array* pIDs = new xsd__string_Array();
> 	xsd__string* p = new xsd__string[3];
>        p[0] = strdup("");
> 	p[1] = strdup("");
> 	p[2] = strdup("");
> 	pIDs->set(p,3);	
> 	return pIDs;
> //>mxiong debug 2006/5/19
> }
> You can found that the response xsi:nil="true" is wrong.
> That will cause my client application rejecting to accept this response for it does not follow contracted schema.
> [My Solution]: 
> After analyzing and debug to axis-c-1.6beta code, I modified soap/xsd/String.cpp, it became OK.
> My modification is like the below:
> String::String(const xsd__string value)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "String", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
> //<mxiong debug 2006/5/19
> //        if (value)
> //        {
>             setNil(false);
>             serialize(value);
> //        }
> //>mxiong debug 2006/5/19
> 	{
> 		#ifdef ENABLE_AXISTRACE
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "String", this, 0);	  /* AUTOINSERTED TRACE */
> 		#endif
> 		return;
> 	}
> }
> AxisChar* String::serialize(const xsd__string value) throw (AxisSoapException)
> {
> 	#ifdef ENABLE_AXISTRACE
> 		if (axiscpp::AxisTrace::isTraceOn())
> 			axiscpp::AxisTrace::traceEntry("String", "serialize", this, 1,
> 					TRACETYPE_STRING, 0, ((void*)&value));	  /* AUTOINSERTED TRACE */
> 	#endif
>     MinLength* minLength= getMinLength();
> //<mxiong debug 2006/5/19
> 	unsigned int nLen = 0;		
> //>mxiong debug 2006/5/19
>     if (minLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> 	if (NULL != value)
> 	{
> 		nLen = strlen(value);
> 	}		
>         if (nLen < (unsigned int) minLength->getMinLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) < (unsigned int) 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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete minLength;
>     
>     MaxLength* maxLength = getMaxLength();
>     if (maxLength->isSet())
>     {
> //<mxiong debug 2006/5/19
> //        if (strlen(value) > (unsigned int) maxLength->getMaxLength())
>         if (nLen > (unsigned int) maxLength->getMaxLength())
> //>mxiong debug 2006/5/19
>         {
>             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 += ".";
>             delete [] length;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete maxLength;
>     Length* length = getLength();
>     if (length->isSet())
>     {
> //<mxiong debug 2006/5/19
>         if (nLen != (unsigned int) length->getLength())
> //>mxiong debug 2006/5/19
> //        if (strlen(value) != (unsigned int) length->getLength())
>         {
>             AxisString exceptionMessage =
>             "Length of value to be serialized is not the same as Length specified for this type.  Length = ";
>             AxisChar* lengthAsString = new AxisChar[10];
>             sprintf(lengthAsString, "%d", length->getLength());
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ", Length of value = ";
>             sprintf(lengthAsString, "%d", strlen(value));
>             exceptionMessage += lengthAsString;
>             exceptionMessage += ".";
>             delete [] lengthAsString;
>             
>             throw AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR,
>                 const_cast<AxisChar*>(exceptionMessage.c_str()));
>         }
>     }
>     delete length;
> //<mxiong debug 2006/5/19 
> 	AxisString valueAsString;
> 	if (NULL != value)
> 	{
> 		valueAsString = value;
> 	} else
> 	{
> 		valueAsString = "";
> 	}
> //>mxiong debug 2006/5/19
> //	AxisString valueAsString = value;
> 	AxisChar* serializedValue = (AxisChar*) replaceReservedCharacters(valueAsString).c_str();
>     IAnySimpleType::serialize(serializedValue);
>     	{
> 		#ifdef ENABLE_AXISTRACE
> 			AxisChar* traceRet = (m_Buf);
> 			if (axiscpp::AxisTrace::isTraceOn())
> 				axiscpp::AxisTrace::traceExit("String", "serialize", this, 0,
> 					TRACETYPE_STRING, 0, ((void*)&traceRet));	  /* AUTOINSERTED TRACE */
> 			return traceRet;
> 		#else
> 			return m_Buf;
> 		#endif
> 	}
> }
> So I think axis-c-1.6beta has bug in dealing with "nillable" for nearly any XSD types, especially for String type as my sample indicated.
> [Suggestion]
> Would you like to give it a careful check to correct this problem in axis-c-1.6beta? 
> My modification may be regarded as a candicate solution for you to resolve this problem, but I wish maybe a better detail design for axis-c-1.6beta on "nillable" area may be better.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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