Difference between revisions of "ZSI"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 25: | Line 25: | ||
# anames and serialize them. Only support one <any> in all content. | # anames and serialize them. Only support one <any> in all content. | ||
# Must be self-describing instances | # Must be self-describing instances | ||
# Regular handling of declared elements | # Regular handling of declared elements | ||
aname = what.aname | aname = what.aname | ||
v = f(aname) | v = f(aname) | ||
# print '@PLH@ what.__dict__ = "%s"' % what.__dict__ | # print '@PLH@ what.__dict__ = "%s"' % what.__dict__ | ||
# print '@PLH@ pname = "%s", v = "%s"' % (what.pname, v) | # print '@PLH@ pname = "%s", v = "%s"' % (what.pname, v) | ||
# print '@PLH@ v = "%s"' % v | # print '@PLH@ v = "%s"' % v | ||
indx += 1 | indx += 1 | ||
if what.minOccurs == 0 and v is None: | if what.minOccurs == 0 and v is None: | ||
continue | continue | ||
# Default to typecode, if self-describing instance, and check | # Default to typecode, if self-describing instance, and check | ||
# to make sure it is derived from what. | # to make sure it is derived from what. | ||
Line 46: | Line 46: | ||
self.nspname,self.pname,what.aname,whatTC.maxOccurs,_seqtypes), | self.nspname,self.pname,what.aname,whatTC.maxOccurs,_seqtypes), | ||
sw.Backtrace(elt)) | sw.Backtrace(elt)) | ||
for v2 in v: | for v2 in v: | ||
occurs += 1 | occurs += 1 | ||
Line 53: | Line 53: | ||
occurs, whatTC.maxOccurs, what.pname), | occurs, whatTC.maxOccurs, what.pname), | ||
sw.Backtrace(elt)) | sw.Backtrace(elt)) | ||
what = _get_type_or_substitute(whatTC, v2, sw, elt) | what = _get_type_or_substitute(whatTC, v2, sw, elt) | ||
# print '@PLH@ what = "%s"' % what | # print '@PLH@ what = "%s"' % what | ||
if debug and what is not whatTC: | if debug and what is not whatTC: | ||
self.logger.debug('substitute derived type: %s' % | self.logger.debug('substitute derived type: %s' % | ||
Line 70: | Line 70: | ||
# raise EvaluateException('Serializing %s.%s, %s %s' % | # raise EvaluateException('Serializing %s.%s, %s %s' % | ||
# (n, whatTC.aname or '?', e.__class__.__name__, str(e))) | # (n, whatTC.aname or '?', e.__class__.__name__, str(e))) | ||
if occurs < whatTC.minOccurs: | if occurs < whatTC.minOccurs: | ||
raise EvaluateException(\ | raise EvaluateException(\ | ||
'occurances(%d) less than minOccurs(%d) for <%s>' % | 'occurances(%d) less than minOccurs(%d) for <%s>' % | ||
(occurs, whatTC.minOccurs, what.pname), sw.Backtrace(elt)) | (occurs, whatTC.minOccurs, what.pname), sw.Backtrace(elt)) | ||
continue | continue | ||
if v is not None or what.nillable is True: | if v is not None or what.nillable is True: | ||
what = _get_type_or_substitute(whatTC, v, sw, elt) | what = _get_type_or_substitute(whatTC, v, sw, elt) | ||
Line 83: | Line 83: | ||
self.logger.debug('substitute derived type: %s' % | self.logger.debug('substitute derived type: %s' % | ||
what.__class__) | what.__class__) | ||
kw['typed'] = False | kw['typed'] = False | ||
# print '@PLH@ elem = "%s"\n sw = "%s"\n v = "%s" kw = "%s"' % (elem, sw, v, kw) | # print '@PLH@ elem = "%s"\n sw = "%s"\n v = "%s" kw = "%s"' % (elem, sw, v, kw) | ||
what.serialize(elem, sw, v, **kw) | what.serialize(elem, sw, v, **kw) | ||
# try: | # try: | ||
# what.serialize(elem, sw, v, **kw) | # what.serialize(elem, sw, v, **kw) | ||
Line 99: | Line 99: | ||
# sw.Backtrace(elt)) | # sw.Backtrace(elt)) | ||
continue | continue | ||
raise EvaluateException('Got None for nillable(%s), minOccurs(%d) element (%s,%s), %s' % | raise EvaluateException('Got None for nillable(%s), minOccurs(%d) element (%s,%s), %s' % | ||
Revision as of 14:55, 19 December 2007
Zolera SOAP Infrastructure (ZSI)
See Also:
ZSI Module Customizations
Disabling Explicit Type Strings in XML
In order to disable the inclusion of typing strings in the XML the following customisation was made to TCcompound.py script. This involved adding the line:
'kw['typed'] = False'
at line 435 of the file. This turns off the explicit typing within the XML.
# anames and serialize them. Only support one <any> in all content. # Must be self-describing instances # Regular handling of declared elements aname = what.aname v = f(aname) # print '@PLH@ what.__dict__ = "%s"' % what.__dict__ # print '@PLH@ pname = "%s", v = "%s"' % (what.pname, v) # print '@PLH@ v = "%s"' % v indx += 1 if what.minOccurs == 0 and v is None: continue # Default to typecode, if self-describing instance, and check # to make sure it is derived from what. whatTC = what if whatTC.maxOccurs > 1 and v is not None: if type(v) not in _seqtypes: raise EvaluateException('pyobj (%s,%s), aname "%s": maxOccurs %s, expecting a %s' %( self.nspname,self.pname,what.aname,whatTC.maxOccurs,_seqtypes), sw.Backtrace(elt)) for v2 in v: occurs += 1 if occurs > whatTC.maxOccurs: raise EvaluateException('occurances (%d) exceeded maxOccurs(%d) for <%s>' %( occurs, whatTC.maxOccurs, what.pname), sw.Backtrace(elt)) what = _get_type_or_substitute(whatTC, v2, sw, elt) # print '@PLH@ what = "%s"' % what if debug and what is not whatTC: self.logger.debug('substitute derived type: %s' % what.__class__)
# print '@PLH@ elem = "%s"\n sw = "%s"\n v2 = "%s"' % (elem, sw, v2)
what.serialize(elem, sw, v2, **kw) # try: # what.serialize(elem, sw, v2, **kw) # except Exception, e: # raise EvaluateException('Serializing %s.%s, %s %s' % # (n, whatTC.aname or '?', e.__class__.__name__, str(e))) if occurs < whatTC.minOccurs: raise EvaluateException(\ 'occurances(%d) less than minOccurs(%d) for <%s>' % (occurs, whatTC.minOccurs, what.pname), sw.Backtrace(elt)) continue if v is not None or what.nillable is True: what = _get_type_or_substitute(whatTC, v, sw, elt) if debug and what is not whatTC: self.logger.debug('substitute derived type: %s' % what.__class__) kw['typed'] = False # print '@PLH@ elem = "%s"\n sw = "%s"\n v = "%s" kw = "%s"' % (elem, sw, v, kw) what.serialize(elem, sw, v, **kw) # try: # what.serialize(elem, sw, v, **kw) # except (ParseException, EvaluateException), e: # raise # except Exception, e: # raise EvaluateException('Serializing %s.%s, %s %s' % # (n, whatTC.aname or '?', e.__class__.__name__, str(e)), # sw.Backtrace(elt)) continue raise EvaluateException('Got None for nillable(%s), minOccurs(%d) element (%s,%s), %s' %