Hello,
Both AxisC 1.5 and the upcoming 1.6 have issues with serializexxx methods in
generated code.
The point is that all data items are passed as void* (opaque pointers).
Therefore integer items get an ampersand & applied in front like
pSZ->serializeAsAttribute( "xsi:nil", 0, (void*)&(xsd_boolean_true),
XSD_BOOLEAN);
But string/char*/AxisChar* items are already pointers themselves, so no
ampersand should be applied:
pSZ->serializeAsAttribute("MatchType", 0, (void*)(param->MatchType),
XSD_NMTOKEN);
What can now observed with my example is that AxisC 1.5 does it wrong in two
places:
pSZ->serializeAsAttribute("MatchType", 0, (void*)&(param->MatchType),
XSD_NMTOKEN);
pSZ->serializeAsChardata((void*)&(param->t_OrgNameSearch_value),
XSD_STRING);
whereas AxisC 1.6 is right in the first and still wrong in the second case:
pSZ->serializeAsAttribute("MatchType", 0, (void*)(param->MatchType),
XSD_NMTOKEN);
pSZ->serializeAsChardata((void*)&(param->t_OrgNameSearch_value),
XSD_STRING);
Note that the attached generated sources are from AxisC 1.6.
AxisC 1.5 has other issues with the code in question (attributes of type
XSD_NMTOKEN are not serialized at all; members of structs already out of
scope are accessed), but these seem to be fixed with AxisC 1.6.
Is this issue already known and present in JIRA?Greetings Franz Dr. Franz Fehringer (Dipl. Math.) ____________________________________ ISO Software Systeme Eichendorffstrasse 29 90491 Nürnberg Deutschland Tel. : +49/(911) - 99594-0 Fax : +49/(911) - 99594-580 mailto:[EMAIL PROTECTED] http://www.isogmbh.de
vakanz.wsdl
Description: application/xml
vakanz.xsd
Description: application/xml
/* * Copyright 2003-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws) * This file contains functions to manipulate complex type t_OrgNameSearch */ #include <axis/AxisWrapperAPI.hpp> #include <axis/Axis.hpp> #include "t_OrgNameSearch.hpp" xsd__NMTOKEN t_OrgNameSearch::getMatchType() { return MatchType ; } void t_OrgNameSearch::setMatchType(xsd__NMTOKEN InValue, bool deep) { if (MatchType != NULL) { if (__axis_deepcopy_MatchType) { delete [] MatchType; } MatchType = NULL; } if(InValue != NULL) { if (deep) { MatchType = new char[strlen(InValue) + 1]; strcpy(MatchType, InValue); } else { MatchType = InValue; } } else { MatchType = NULL; } __axis_deepcopy_MatchType = deep; } /* * This static method serialize a t_OrgNameSearch type of object */ int Axis_Serialize_t_OrgNameSearch(t_OrgNameSearch* param, IWrapperSoapSerializer* pSZ, bool bArray = false) { if ( param == NULL ) { pSZ->serializeAsAttribute( "xsi:nil", 0, (void*)&(xsd_boolean_true), XSD_BOOLEAN); pSZ->serialize( ">", NULL); return AXIS_SUCCESS; } bool blnIsNewPrefix = false; if (!bArray) { const AxisChar* sPrefix = pSZ->getNamespacePrefix(Axis_URI_t_OrgNameSearch, blnIsNewPrefix); if (blnIsNewPrefix) { pSZ->serialize(" xmlns:", sPrefix, "=\"", Axis_URI_t_OrgNameSearch, "\"", NULL ); } } /* If there are any attributes serialize them. If there aren't then close the tag */ if (0 != param->MatchType) pSZ->serializeAsAttribute("MatchType", 0, (void*)(param->MatchType), XSD_NMTOKEN); pSZ->serialize( ">", 0); pSZ->serializeAsChardata((void*)&(param->t_OrgNameSearch_value), XSD_STRING); /* then serialize elements if any*/ if (!bArray && blnIsNewPrefix) { pSZ->removeNamespacePrefix(Axis_URI_t_OrgNameSearch); } return AXIS_SUCCESS; } /* * This static method deserialize a t_OrgNameSearch type of object */ int Axis_DeSerialize_t_OrgNameSearch(t_OrgNameSearch* param, IWrapperSoapDeSerializer* pIWSDZ) { xsd__NMTOKEN pValue0 = pIWSDZ->getAttributeAsNMTOKEN( "MatchType", 0); if( pValue0 == NULL) { param->MatchType = NULL; } else { param->setMatchType (pValue0); Axis::AxisDelete( (void *) pValue0, XSD_NMTOKEN); } pIWSDZ->getChardataAs((void*)&(param->t_OrgNameSearch_value), XSD_STRING); return pIWSDZ->getStatus(); } void* Axis_Create_t_OrgNameSearch(t_OrgNameSearch* pObj, bool bArray = false, int nSize=0) { if (bArray && (nSize > 0)) { if (pObj) { t_OrgNameSearch* pNew = new t_OrgNameSearch[nSize]; size_t i = nSize/2; for (int ii = 0; ii < (int) i; ++ii) { pNew[ii] = pObj[ii]; pObj[ii].reset(); } delete [] pObj; return pNew; } else { return new t_OrgNameSearch[nSize]; } } else return new t_OrgNameSearch; } /* * This static method delete a t_OrgNameSearch type of object */ void Axis_Delete_t_OrgNameSearch(t_OrgNameSearch* param, bool bArray = false, int nSize=0) { if (bArray) { delete [] param; } else { delete param; } } /* * This static method gives the size of t_OrgNameSearch type of object */ int Axis_GetSize_t_OrgNameSearch() { return sizeof(t_OrgNameSearch); } t_OrgNameSearch::t_OrgNameSearch() { reset(); } t_OrgNameSearch::t_OrgNameSearch(const t_OrgNameSearch & original) { MatchType = NULL; __axis_deepcopy_MatchType = false; setMatchType(original.MatchType, original.__axis_deepcopy_MatchType); } void t_OrgNameSearch::reset() { /*do not allocate memory to any pointer members here because deserializer will allocate memory anyway. */ MatchType = NULL; __axis_deepcopy_MatchType = false; } t_OrgNameSearch::~t_OrgNameSearch() { /*delete any pointer and array members here*/ if (MatchType != NULL) { if(__axis_deepcopy_MatchType) { delete [] MatchType; } MatchType = NULL; } }
