WebSphere Message Service Clients: Web Services Client for C++, Version 1.1 Operating Systems: Linux, Windows

Summary of rules

There are a number of rules relating to memory management that you must follow when developing web service client applications.

  1. Objects that are passed to or obtained from the web service method as pointers are the responsibility of the client application.
  2. Objects that are defined as a class hide the objects that they contain and instead have get and set methods to manipulate the object contents.
  3. For objects that are classes and used as inputs, the client application is responsible for the deletion of these objects when they are no longer required.
  4. For objects that are classes and used as outputs, the client application is responsible for the deletion of these objects when they are no longer required. They must not delete any object that is returned from a call to the ‘get’ method as this is deleted by the parent when the parent object is deleted.
  5. If a stub is "new"ed (rather than being a stack object), it must be deleted.
  6. Return parameters must be deleted when they are one of:
    • Complex type
    • Array
    • String based type rule 7
    • Nillable
    • Optional
  7. When deleting string based types, use: delete [] string;. The string based types are: xsd__string, xsd__normalizedString, xsd__token, xsd__language, xsd__Name, xsd__NCName, xsd__ID, xsd__IDREF, xsd__IDREFS, xsd__ENTITY, xsd__ENTITIES, xsd__NMTOKEN, xsd__NMTOKENS, xsd__anyURI, xsd__QName and xsd__NOTATION.
  8. The "set(xsd__unsignedByte * data, xsd__int size)" method on xsd__hexBinary and xsd__base64Binary take a copy of the data. Remember to delete the original data.
  9. When using the "xsd__unsignedByte * get(xsd__int & size) const" method on xsd__hexBinary and xsd__base64Binary do NOT delete the returned pointer, as this pointer is deleted by the destructor on the xsd__base64Binary or xsd__hexBinary object.
  10. When setting members of complex types, the corresponding set method takes a deep copy of the original data. Remember to delete the original data.
  11. Setting members of complex types directly (that is, not using the corresponding set method) is not supported and may produce unknown side-effects.
  12. When initializing an Array (Axis_Array and its derivates - xsd__<built-in simple type>_Array or <generated type>_Array) using the set() method takes a deep copy of the data. Remember to delete the original array elements and the original c-style pointer array.
Related reference
XML built-in simple types
Arrays of simple type
Deep copying
Complex types and arrays of complex type

Reference topic

Terms of Use | Rate this page

Last updated: 25 Jan 2006

© Copyright IBM Corporation 2005, 2006. All Rights Reserved.