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 Dushshantha Chandradasa <dc...@virtusa.com> on 2005/05/17 12:52:01 UTC
Handling Nillable elements which are wsdl choices
Hi All,
I implemented the support for 'choice' WSDL construct in Axis C++ .
According to our design, generated stub level classes serialize the
choice elements in the following way.
int Axis_Serialize_ChoiceComplexType(ChoiceComplexType* param,
IWrapperSoapSerializer* pSZ, bool bArray = false)
{
if ( param == NULL )
{
/* TODO : may need to check nillable value - Now done*/
pSZ->serializeAsAttribute( "xsi:nil", 0,
(void*)&(xsd_boolean_true), XSD_BOOLEAN);
pSZ->serialize( ">", NULL);
return AXIS_SUCCESS;
}
/* first serialize attributes if any*/
pSZ->serialize( ">", 0);
/* then serialize elements if any*/
pSZ->serializeAsElement("NonChoiceIntValue",
Axis_URI_ChoiceComplexType, (void*)&(param->NonChoiceIntValue),
XSD_INT);
//......................................................................
..............................................................
//Following two elements are choice elements
// if the element is not NULL it goes to deserializer
if(param->IntValue)
{
pSZ->serializeAsElement("IntValue",
Axis_URI_ChoiceComplexType, (void*)(param->IntValue), XSD_INT);
}
else if(param->StringValue)
{
pSZ->serializeAsElement("StringValue",
Axis_URI_ChoiceComplexType, (void*)(param->StringValue), XSD_STRING);
}
//......................................................................
..................................................................
pSZ->serializeAsElement("NonChoiceStringValue",
Axis_URI_ChoiceComplexType, (void*)(param->NonChoiceStringValue),
XSD_STRING);
return AXIS_SUCCESS;
}
But if the choice element is a nillable one and its value is set to
NULL, then the above logic will fail.
Any thoughts on this??
Regards,
Marcus Dushshantha Chandradasa
Associate Software Engineer
Virtusa (Pvt) Ltd.
dchandradasa@virtusa.com
Mob: 0714867441