You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(47) |
Apr
(48) |
May
(68) |
Jun
(9) |
Jul
(43) |
Aug
(10) |
Sep
(81) |
Oct
(43) |
Nov
(22) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(44) |
Feb
(48) |
Mar
(53) |
Apr
(40) |
May
(107) |
Jun
(28) |
Jul
(8) |
Aug
(8) |
Sep
(28) |
Oct
(32) |
Nov
(43) |
Dec
(13) |
2005 |
Jan
(45) |
Feb
(110) |
Mar
(36) |
Apr
(14) |
May
(28) |
Jun
(3) |
Jul
(10) |
Aug
(8) |
Sep
(27) |
Oct
(13) |
Nov
(3) |
Dec
(20) |
2006 |
Jan
(32) |
Feb
(29) |
Mar
(17) |
Apr
(21) |
May
(38) |
Jun
(14) |
Jul
(6) |
Aug
(2) |
Sep
(4) |
Oct
(36) |
Nov
(11) |
Dec
(10) |
2007 |
Jan
(41) |
Feb
(10) |
Mar
(7) |
Apr
(7) |
May
(10) |
Jun
(15) |
Jul
(11) |
Aug
(1) |
Sep
(3) |
Oct
(13) |
Nov
(16) |
Dec
(1) |
2008 |
Jan
(9) |
Feb
(1) |
Mar
|
Apr
|
May
(22) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(7) |
2009 |
Jan
(3) |
Feb
(1) |
Mar
(3) |
Apr
(6) |
May
(3) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ps...@us...> - 2008-12-12 14:24:44
|
Revision: 1477 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1477&view=rev Author: psha Date: 2008-12-12 14:24:40 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Implement TC.Union.text_to_data method Just like TC.Union.parse - try to parse by every member typecode and raise exception if none succeded. Needed by WS-Addressing for RelationshipType attribute http://www.w3.org/Submission/ws-addressing/#_Toc77464323 Modified Paths: -------------- trunk/zsi/ZSI/TC.py trunk/zsi/test/test_union.py Modified: trunk/zsi/ZSI/TC.py =================================================================== --- trunk/zsi/ZSI/TC.py 2008-12-12 08:05:39 UTC (rev 1476) +++ trunk/zsi/ZSI/TC.py 2008-12-12 14:24:40 UTC (rev 1477) @@ -1575,6 +1575,29 @@ return pyobj + def text_to_data(self, text, elt, ps): + """ Copy of parse method with some cleanups and logging""" + self.setMemberTypeCodes() + + for indx in range(len(self.memberTypeCodes)): + typecode = self.memberTypeCodes[indx] + self.logger.debug("Trying member %s", str(typecode.type)) + try: + pyobj = typecode.text_to_data(text, elt, ps) + except Exception, ex: + self.logger.debug("Fail to parse with %s: %s", typecode, ex) + continue + + if indx > 0: + self.memberTypeCodes.remove(typecode) + self.memberTypeCodes.insert(0, typecode) + break + else: + raise EvaluateException('No member matches data "%s" (while parsing %s)' % (text, str(self.type)), + ps.Backtrace(elt)) + + return pyobj + def get_formatted_content(self, pyobj, **kw): self.setMemberTypeCodes() for indx in range(len(self.memberTypeCodes)): Modified: trunk/zsi/test/test_union.py =================================================================== --- trunk/zsi/test/test_union.py 2008-12-12 08:05:39 UTC (rev 1476) +++ trunk/zsi/test/test_union.py 2008-12-12 14:24:40 UTC (rev 1477) @@ -8,7 +8,6 @@ from ZSI.wstools.Namespaces import WSA200403, SOAP from cStringIO import StringIO - # # Generated code class ns3: @@ -34,8 +33,13 @@ def __init__(self, pname, **kw): ZSI.TC.Union.__init__(self, pname, **kw) +class TestUnionTC(ZSI.TC.Union, TypeDefinition): + memberTypes = [(u'http://www.w3.org/2001/XMLSchema', u'long'), (u'http://www.w3.org/2001/XMLSchema', u'dateTime')] + schema = "urn:test:union" + type = (schema, "TestUnion") + def __init__(self, pname, **kw): + ZSI.TC.Union.__init__(self, pname, **kw) - class UnionTestCase(unittest.TestCase): "test Union TypeCode" @@ -61,8 +65,17 @@ # so string is going to parse the URI when we want anyURI self.failUnless(value == pyobj, 'Expected equivalent') + def check_union_text_to_data(self): + from ZSI.TC import EvaluateException + class _PS: + def Backtrace(self, *a, **kw): return "" + typecode = TestUnionTC("TestUnion") + self.assertEquals(100, typecode.text_to_data('100', None, None), "Fail to parse long") + date = typecode.text_to_data("2002-10-30T12:30:00Z", None, None) + self.assertEquals((2002, 10, 30), date[:3], "Fail to parse dateTime") + self.assertRaises(EvaluateException, typecode.text_to_data, "urn:string", None, _PS()) + - def makeTestSuite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(UnionTestCase, "check")) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-12-12 08:05:47
|
Revision: 1476 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1476&view=rev Author: psha Date: 2008-12-12 08:05:39 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Fix timezone handling in TCtimes Time * When parsing convert all times (dateTime and gTime elements) to local timezone if possible (year must be in range [datetime.MINYEAR, datetime.MAXYEAR]) * dateTime and gTime are serialized to UTC timezone. Argument is treated as local time Date * Date formats (gDate, gYear, ...) ignore timezone portion e.g. values 1968+15:00, 1968Z and 1968 are equal. So this part is not confirming to specs. * Serialize all dates without timezone part. Fixed bugs: #2133723 #2014802 Modified Paths: -------------- trunk/zsi/ZSI/TCtimes.py trunk/zsi/test/test_TCtimes.py Modified: trunk/zsi/ZSI/TCtimes.py =================================================================== --- trunk/zsi/ZSI/TCtimes.py 2008-12-11 04:20:26 UTC (rev 1475) +++ trunk/zsi/ZSI/TCtimes.py 2008-12-12 08:05:39 UTC (rev 1476) @@ -9,14 +9,11 @@ import operator, re, time as _time from time import mktime as _mktime, localtime as _localtime, gmtime as _gmtime from datetime import tzinfo as _tzinfo, timedelta as _timedelta,\ - datetime as _datetime + datetime as _datetime, MINYEAR, MAXYEAR from math import modf as _modf -_niltime = [ - 0, 0, 0, # year month day - 0, 0, 0, # hour minute second - 0, 0, 0 # weekday, julian day, dst flag -] +# Year, month or day may be None +_niltime = [None] * 3 + [0] * 6 #### Code added to check current timezone offset _zero = _timedelta(0) @@ -24,7 +21,6 @@ if _time.daylight: _dstoffset = _timedelta(seconds=-_time.altzone) _dstdiff = _dstoffset - _stdoffset - class _localtimezone(_tzinfo): """ """ def dst(self, dt): @@ -75,6 +71,41 @@ """datetime -> minutes east of UTC (negative for west of UTC).""" return self.__offset +def _tz_to_tzinfo(tz): + if not tz: + return _localtimezone() + if tz == "Z": tz = "+00:00" + h, m = map(int, tz.split(':')) + if h < 0: m = -m + return _fixedoffset(60 * h + m) + +def _fix_timezone(tv, tz_from = "Z", tz_to = None): + if None in tv[3:5]: # Hour or minute is absent + return tv + + # Fix local copy of time tuple + ltv = list(_fix_none_fields(tv)) + + if ltv[0] < MINYEAR or ltv[0] > MAXYEAR: + return tv # Unable to fix timestamp + + _tz_from = _tz_to_tzinfo(tz_from) + _tz_to = _tz_to_tzinfo(tz_to) + + ltv[:6] = _datetime(*(ltv[:6] + [0, _tz_from])).astimezone(_tz_to).timetuple()[:6] + + # Patch local copy with original values + for i in range(0, 6): + if tv[i] is None: ltv[i] = None + + return tuple(ltv) + +def _fix_none_fields(tv): + ltv = list(tv) + if ltv[0] is None: ltv[0] = MINYEAR + 1 # Year is absent + if ltv[1] is None: ltv[1] = 1 # Month is absent + if ltv[2] is None: ltv[2] = 1 # Day is absent + return tuple(ltv) def _dict_to_tuple(d): '''Convert a dictionary to a time tuple. Depends on key values in the @@ -96,42 +127,10 @@ if v: msec,sec = _modf(float(v)) retval[6],retval[5] = int(round(msec*1000)), int(sec) - - v = d.get('tz') - if v and v != 'Z': - h,m = map(int, v.split(':')) - # check for time zone offset, if within the same timezone, - # ignore offset specific calculations - offset=_localtimezone().utcoffset(_datetime.now()) - local_offset_hour = offset.seconds/3600 - local_offset_min = (offset.seconds%3600)%60 - if local_offset_hour > 12: - local_offset_hour -= 24 - - if local_offset_hour != h or local_offset_min != m: - if h<0: - #TODO: why is this set to server - #foff = _fixedoffset(-((abs(h)*60+m)),"server") - foff = _fixedoffset(-((abs(h)*60+m))) - else: - #TODO: why is this set to server - #foff = _fixedoffset((abs(h)*60+m),"server") - foff = _fixedoffset((abs(h)*60+m)) - - dt = _datetime(retval[0],retval[1],retval[2],retval[3],retval[4], - retval[5],0,foff) - - # update dict with calculated timezone - localdt=dt.astimezone(_localtimezone()) - retval[0] = localdt.year - retval[1] = localdt.month - retval[2] = localdt.day - retval[3] = localdt.hour - retval[4] = localdt.minute - retval[5] = localdt.second - + if d.get('neg', 0): - retval[0:5] = map(operator.__neg__, retval[0:5]) + retval[0:5] = map(lambda x: (x is not None or x) and operator.__neg__(x), retval[0:5]) + return tuple(retval) @@ -188,6 +187,7 @@ '''Gregorian times. ''' lex_pattern = tag = format = None + fix_timezone = False def text_to_data(self, text, elt, ps): '''convert text into typecode specific data. @@ -203,7 +203,12 @@ except ValueError, e: #raise EvaluateException(str(e)) raise - + + if self.fix_timezone: + retval = _fix_timezone(retval, tz_from = m.groupdict().get('tz'), tz_to = None) + + retval = _fix_none_fields(retval) + if self.pyclass is not None: return self.pyclass(retval) return retval @@ -212,6 +217,9 @@ if type(pyobj) in _floattypes or type(pyobj) in _inttypes: pyobj = _gmtime(pyobj) + if self.fix_timezone: + pyobj = _fix_timezone(pyobj, tz_from = None, tz_to = "Z") + d = {} pyobj = tuple(pyobj) if 1 in map(lambda x: x < 0, pyobj[0:6]): @@ -220,17 +228,18 @@ else: d['neg'] = '' + d = {} + for k,i in [ ('Y', 0), ('M', 1), ('D', 2), ('h', 3), ('m', 4), ('s', 5) ]: + d[k] = pyobj[i] + ms = pyobj[6] if not ms or not hasattr(self, 'format_ms'): - d = { 'Y': pyobj[0], 'M': pyobj[1], 'D': pyobj[2], - 'h': pyobj[3], 'm': pyobj[4], 's': pyobj[5], } return self.format % d if ms > 999: raise ValueError, 'milliseconds must be a integer between 0 and 999' - d = { 'Y': pyobj[0], 'M': pyobj[1], 'D': pyobj[2], - 'h': pyobj[3], 'm': pyobj[4], 's': pyobj[5], 'ms':ms, } + d['ms'] = ms return self.format_ms % d @@ -245,6 +254,7 @@ tag, format = 'dateTime', '%(Y)04d-%(M)02d-%(D)02dT%(h)02d:%(m)02d:%(s)02dZ' format_ms = format[:-1] + '.%(ms)03dZ' type = (SCHEMA.XSD3, 'dateTime') + fix_timezone = True class gDate(Gregorian): '''A date. @@ -253,7 +263,7 @@ lex_pattern = re.compile('^' r'(?P<neg>-?)' \ '(?P<Y>\d{4,})-' r'(?P<M>\d\d)-' r'(?P<D>\d\d)' \ r'(?P<tz>Z|([-+]\d\d:\d\d))?' '$') - tag, format = 'date', '%(Y)04d-%(M)02d-%(D)02dZ' + tag, format = 'date', '%(Y)04d-%(M)02d-%(D)02d' type = (SCHEMA.XSD3, 'date') class gYearMonth(Gregorian): @@ -263,7 +273,7 @@ lex_pattern = re.compile('^' r'(?P<neg>-?)' \ '(?P<Y>\d{4,})-' r'(?P<M>\d\d)' \ r'(?P<tz>Z|([-+]\d\d:\d\d))?' '$') - tag, format = 'gYearMonth', '%(Y)04d-%(M)02dZ' + tag, format = 'gYearMonth', '%(Y)04d-%(M)02d' type = (SCHEMA.XSD3, 'gYearMonth') class gYear(Gregorian): @@ -273,7 +283,7 @@ lex_pattern = re.compile('^' r'(?P<neg>-?)' \ '(?P<Y>\d{4,})' \ r'(?P<tz>Z|([-+]\d\d:\d\d))?' '$') - tag, format = 'gYear', '%(Y)04dZ' + tag, format = 'gYear', '%(Y)04d' type = (SCHEMA.XSD3, 'gYear') class gMonthDay(Gregorian): @@ -283,7 +293,7 @@ lex_pattern = re.compile('^' r'(?P<neg>-?)' \ r'--(?P<M>\d\d)-' r'(?P<D>\d\d)' \ r'(?P<tz>Z|([-+]\d\d:\d\d))?' '$') - tag, format = 'gMonthDay', '---%(M)02d-%(D)02dZ' + tag, format = 'gMonthDay', '--%(M)02d-%(D)02d' type = (SCHEMA.XSD3, 'gMonthDay') @@ -294,7 +304,7 @@ lex_pattern = re.compile('^' r'(?P<neg>-?)' \ r'---(?P<D>\d\d)' \ r'(?P<tz>Z|([-+]\d\d:\d\d))?' '$') - tag, format = 'gDay', '---%(D)02dZ' + tag, format = 'gDay', '---%(D)02d' type = (SCHEMA.XSD3, 'gDay') class gMonth(Gregorian): @@ -302,9 +312,9 @@ ''' parselist = [ (None,'gMonth') ] lex_pattern = re.compile('^' r'(?P<neg>-?)' \ - r'---(?P<M>\d\d)' \ + r'--(?P<M>\d\d)' \ r'(?P<tz>Z|([-+]\d\d:\d\d))?' '$') - tag, format = 'gMonth', '---%(M)02dZ' + tag, format = 'gMonth', '--%(M)02d' type = (SCHEMA.XSD3, 'gMonth') class gTime(Gregorian): @@ -317,5 +327,6 @@ tag, format = 'time', '%(h)02d:%(m)02d:%(s)02dZ' format_ms = format[:-1] + '.%(ms)03dZ' type = (SCHEMA.XSD3, 'time') + fix_timezone = True if __name__ == '__main__': print _copyright Modified: trunk/zsi/test/test_TCtimes.py =================================================================== --- trunk/zsi/test/test_TCtimes.py 2008-12-11 04:20:26 UTC (rev 1475) +++ trunk/zsi/test/test_TCtimes.py 2008-12-12 08:05:39 UTC (rev 1476) @@ -10,21 +10,32 @@ class TestCase(unittest.TestCase): '''Examples from "Definitive XML Schema, Priscilla Walmsley, p237-246 ''' - def check_dateTime_local_offset(self): - # UTC with local timezone offset - # - typecode = TC.gDateTime() - off_hour = time.altzone/60/60 - off_min = time.altzone%60 - stamp_offset = '1968-04-02T13:20:00+%02d:%02d' %(off_hour,off_min) - data = typecode.text_to_data(stamp_offset, None, None) - stamp = typecode.get_formatted_content(data) + def _check_data2data(self, tc, data, correct, msg): + tmp = tc.text_to_data(data, None, None) + stamp = tc.get_formatted_content(tmp) - correct = "1968-04-01T22:20:00Z" self.failUnless(stamp == correct, - 'dateTime with local offset(%s), expecting "%s" got "%s"' %( - stamp_offset, correct, stamp)) + '%s with local offset(%s): expecting "%s" got "%s"' %( + msg, data, correct, stamp)) + def check_datetime_timezone(self): + # UTC with local timezone offset + # Base example from http://www.w3.org/TR/xmlschema11-2/#dateTime-lexical-mapping + + correct = "2002-10-10T17:00:00Z" + for t in ['2002-10-10T12:00:00-05:00', '2002-10-10T19:00:00+02:00', '2002-10-10T17:00:00+00:00', '2002-10-10T17:00:00Z']: + self._check_data2data(TC.gDateTime(), t, correct, 'dateTime') + + def check_time_timezone(self): + correct = "17:30:00Z" + for t in ['12:30:00-05:00', '19:30:00+02:00', '17:30:00+00:00']: + self._check_data2data(TC.gTime(), t, correct, 'time') + + def check_date_timezone(self): + correct = "2002-10-10" + for t in ['2002-10-10-05:00', '2002-10-10+02:00', '2002-10-10+00:00', '2002-10-10Z']: + self._check_data2data(TC.gDate(), t, correct, 'date') + def check_valid_dateTime(self): typecode = TC.gDateTime() for i in ('1968-04-02T13:20:00', '1968-04-02T13:20:15.5', @@ -42,7 +53,7 @@ def check_serialize_microseconds(self): dateTime = '1968-04-02T13:20:15.511Z' typecode = TC.gDateTime() - text = typecode.get_formatted_content((1968, 4, 2, 13, 20, 15, 511, 0, 0)) + text = typecode.get_formatted_content((1968, 4, 2, 13 - time.timezone / 3600, 20, 15, 511, 0, 0)) self.failUnless(text == dateTime, 'did not serialze correctly %s, not equal %s' %(text, dateTime)) @@ -60,7 +71,7 @@ typecode.get_formatted_content(bad) def check_parse_microseconds2(self): - good = (1968, 4, 2, 13, 20, 15, 500, 0, 0) + good = (1968, 4, 2, 13 - time.timezone / 3600, 20, 15, 500, 0, 0) typecode = TC.gDateTime() data = typecode.text_to_data('1968-04-02T13:20:15.5Z', None,None) self.failUnless(data == good, @@ -109,11 +120,32 @@ for i in ('68-04-02', '1968-4-2', '1968/04/02', '04-02-1968',): self.failUnlessRaises(Exception, typecode.text_to_data, i, None, None), + def check_valid_cast(self): + text = "2002-10-10T17:00:00Z" + tc = TC.gDateTime() + data = tc.text_to_data(text, None, None) + + tct = TC.gTime() + tcd = TC.gDate() + self.assertEquals("2002-10-10", tcd.get_formatted_content(data), "Invalid cast from gDateTime to gDate") + self.assertEquals("17:00:00Z", tct.get_formatted_content(data), "Invalid cast from gDateTime to gTime") + def broke_invalid_date_april31(self): # No checks for valid date April 30 days typecode = TC.gDate() self.failUnlessRaises(Exception, typecode.text_to_data, '1968-04-31', None, None), + def check_gdates(self): + def _assert_tc(tc, val, msg): + self.assertEquals(val, tc.get_formatted_content(tc.text_to_data(val, None, None)), "%s: %s" % (msg, val)) + + _assert_tc(TC.gYear(), '1984', "Invalid gYear") + _assert_tc(TC.gYearMonth(), '1984-10', "Invalid gYearMonth") + _assert_tc(TC.gMonth(), '--10', "Invalid gMonth") + _assert_tc(TC.gMonthDay(), '--10-30', "Invalid gMonthDay") + _assert_tc(TC.gDay(), '---30', "Invalid gDay") + _assert_tc(TC.gDate(), '1984-10-30', "Invalid gDate") + # # Creates permutation of test options: "check", "check_any", etc # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-12-11 04:20:28
|
Revision: 1475 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1475&view=rev Author: psha Date: 2008-12-11 04:20:26 +0000 (Thu, 11 Dec 2008) Log Message: ----------- Support parsing TC.XML with maxOccurs > 1 Backward compatible behaviour (e.g returning None or Element) when maxOccurs = 1. Otherwise list of elements is returned (may be empty if minOccurs = 0) Modified Paths: -------------- trunk/zsi/ZSI/TC.py Modified: trunk/zsi/ZSI/TC.py =================================================================== --- trunk/zsi/ZSI/TC.py 2008-12-10 08:08:21 UTC (rev 1474) +++ trunk/zsi/ZSI/TC.py 2008-12-11 04:20:26 UTC (rev 1475) @@ -1247,11 +1247,17 @@ #raise EvaluateException('Embedded XML has unknown encodingStyle', # ps.Backtrace(elt) pass - if len(c) != 1: - raise EvaluateException('Embedded XML has more than one child', + if len(c) < self.minOccurs: + raise EvaluateException('Not enough XML children %d (minOccurs = %d)' % (len(c), self.minOccurs), ps.Backtrace(elt)) - if self.copyit: return c[0].cloneNode(1) - return c[0] + if self.maxOccurs != UNBOUNDED and len(c) > self.maxOccurs: + raise EvaluateException('Too many XML children %d (maxOccurs = %d)' % (len(c), self.maxOccurs), + ps.Backtrace(elt)) + if self.copyit: + c = map(lambda n: n.cloneNode(1), c) + if self.maxOccurs == 1: + return c[0] + return c def serialize(self, elt, sw, pyobj, name=None, unsuppressedPrefixes=[], **kw): objid = _get_idstr(pyobj) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-12-10 08:08:25
|
Revision: 1474 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1474&view=rev Author: psha Date: 2008-12-10 08:08:21 +0000 (Wed, 10 Dec 2008) Log Message: ----------- Serialize ReferenceParameters of EndpointReference In W3C recomendations ReferenceProperties attribute changed to ReferenceParameters. http://www.w3.org/TR/ws-addr-core/#msgaddrpropsinfoset Modified Paths: -------------- trunk/zsi/ZSI/address.py Modified: trunk/zsi/ZSI/address.py =================================================================== --- trunk/zsi/ZSI/address.py 2008-12-10 08:06:29 UTC (rev 1473) +++ trunk/zsi/ZSI/address.py 2008-12-10 08:08:21 UTC (rev 1474) @@ -184,6 +184,8 @@ %GTD(namespaceURI ,'EndpointReferenceType') ReferenceProperties = getattr(endPointReference, '_ReferenceProperties', None) + if ReferenceProperties is None: # In recent WS-A attribute name changed + ReferenceProperties = getattr(endPointReference, '_ReferenceParameters', None) if ReferenceProperties is not None: for v in getattr(ReferenceProperties, '_any', ()): if not hasattr(v,'typecode'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-12-10 08:06:32
|
Revision: 1473 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1473&view=rev Author: psha Date: 2008-12-10 08:06:29 +0000 (Wed, 10 Dec 2008) Log Message: ----------- Use property for ADDRESS attribute of WSAW* namespace structure Modified Paths: -------------- trunk/wstools/Namespaces.py Modified: trunk/wstools/Namespaces.py =================================================================== --- trunk/wstools/Namespaces.py 2008-12-10 08:03:17 UTC (rev 1472) +++ trunk/wstools/Namespaces.py 2008-12-10 08:06:29 UTC (rev 1473) @@ -185,10 +185,9 @@ class _WSAW(str): """ Define ADDRESS attribute to be compatible with WSA* layout """ - ADDRESS = "" + ADDRESS = property(lambda s: s) WSAW200605 = _WSAW("http://www.w3.org/2006/05/addressing/wsdl") -WSAW200605.ADDRESS = WSAW200605 # Compatibility hack WSAW_LIST = (WSAW200605,) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-12-10 08:03:24
|
Revision: 1472 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1472&view=rev Author: psha Date: 2008-12-10 08:03:17 +0000 (Wed, 10 Dec 2008) Log Message: ----------- Add support for WS-Addressing WSDL Binding Search for Action attributes not only in WSA*.ADDRESS namespaces but also in WSAW*. wsaw is used by Globus Toolkit 4.2+ See http://www.w3.org/TR/ws-addr-wsdl/ for wsaw definition. Modified Paths: -------------- trunk/wstools/Namespaces.py trunk/wstools/WSDLTools.py Modified: trunk/wstools/Namespaces.py =================================================================== --- trunk/wstools/Namespaces.py 2008-12-10 07:57:09 UTC (rev 1471) +++ trunk/wstools/Namespaces.py 2008-12-10 08:03:17 UTC (rev 1472) @@ -183,6 +183,15 @@ WSA = WSA200408 WSA_LIST = (WSA200508, WSA200408, WSA200403, WSA200303) +class _WSAW(str): + """ Define ADDRESS attribute to be compatible with WSA* layout """ + ADDRESS = "" + +WSAW200605 = _WSAW("http://www.w3.org/2006/05/addressing/wsdl") +WSAW200605.ADDRESS = WSAW200605 # Compatibility hack + +WSAW_LIST = (WSAW200605,) + class WSP: POLICY = "http://schemas.xmlsoap.org/ws/2002/12/policy" Modified: trunk/wstools/WSDLTools.py =================================================================== --- trunk/wstools/WSDLTools.py 2008-12-10 07:57:09 UTC (rev 1471) +++ trunk/wstools/WSDLTools.py 2008-12-10 08:03:17 UTC (rev 1472) @@ -11,7 +11,7 @@ import weakref from cStringIO import StringIO -from Namespaces import OASIS, XMLNS, WSA, WSA_LIST, WSRF_V1_2, WSRF +from Namespaces import OASIS, XMLNS, WSA, WSA_LIST, WSAW_LIST, WSRF_V1_2, WSRF from Utility import Collection, CollectionNS, DOM, ElementProxy, basejoin from XMLSchema import XMLSchema, SchemaReader, WSDLToolsAdapter @@ -596,7 +596,7 @@ docs = GetDocumentation(item) msgref = DOM.getAttr(item, 'message') message = ParseQName(msgref, item) - for WSA in WSA_LIST: + for WSA in WSA_LIST + WSAW_LIST: action = DOM.getAttr(item, 'Action', WSA.ADDRESS, None) if action: break operation.setInput(message, name, docs, action) @@ -607,7 +607,7 @@ docs = GetDocumentation(item) msgref = DOM.getAttr(item, 'message') message = ParseQName(msgref, item) - for WSA in WSA_LIST: + for WSA in WSA_LIST + WSAW_LIST: action = DOM.getAttr(item, 'Action', WSA.ADDRESS, None) if action: break operation.setOutput(message, name, docs, action) @@ -617,7 +617,7 @@ docs = GetDocumentation(item) msgref = DOM.getAttr(item, 'message') message = ParseQName(msgref, item) - for WSA in WSA_LIST: + for WSA in WSA_LIST + WSAW_LIST: action = DOM.getAttr(item, 'Action', WSA.ADDRESS, None) if action: break operation.addFault(message, name, docs, action) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ps...@us...> - 2008-12-10 07:57:17
|
Revision: 1471 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1471&view=rev Author: psha Date: 2008-12-10 07:57:09 +0000 (Wed, 10 Dec 2008) Log Message: ----------- Add WS-Addressing namespace http://www.w3.org/2005/08/addressing/ as WSA200508 Modified Paths: -------------- trunk/wstools/Namespaces.py Modified: trunk/wstools/Namespaces.py =================================================================== --- trunk/wstools/Namespaces.py 2008-11-11 22:14:51 UTC (rev 1470) +++ trunk/wstools/Namespaces.py 2008-12-10 07:57:09 UTC (rev 1471) @@ -159,6 +159,11 @@ LIFETIME = "http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceLifetime" +class WSA200508: + ADDRESS = "http://www.w3.org/2005/08/addressing" + ANONYMOUS = "%s/anonymous" %ADDRESS + FAULT = "%s/fault" %ADDRESS + class WSA200408: ADDRESS = "http://schemas.xmlsoap.org/ws/2004/08/addressing" ANONYMOUS = "%s/role/anonymous" %ADDRESS @@ -176,7 +181,7 @@ WSA = WSA200408 -WSA_LIST = (WSA200408, WSA200403, WSA200303) +WSA_LIST = (WSA200508, WSA200408, WSA200403, WSA200303) class WSP: POLICY = "http://schemas.xmlsoap.org/ws/2002/12/policy" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bov...@us...> - 2008-11-11 22:14:55
|
Revision: 1470 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1470&view=rev Author: boverhof Date: 2008-11-11 22:14:51 +0000 (Tue, 11 Nov 2008) Log Message: ----------- M ZSI/schema.py Fix for Bug Report [ 2264789 ] Lazy Flag elementFormDefault="qualified" Bug""" Modified Paths: -------------- trunk/zsi/ZSI/schema.py Modified: trunk/zsi/ZSI/schema.py =================================================================== --- trunk/zsi/ZSI/schema.py 2008-10-15 19:52:19 UTC (rev 1469) +++ trunk/zsi/ZSI/schema.py 2008-11-11 22:14:51 UTC (rev 1470) @@ -349,7 +349,11 @@ def _reveal_type(self): if self.__cache is None: - self.__cache = self.klass(pname=self.pname, + pname = self.pname + if self.nspname != None: + pname = (self.nspname,self.pname) + + self.__cache = self.klass(pname=pname, aname=self.aname, minOccurs=self.minOccurs, maxOccurs=self.maxOccurs, nillable=self.nillable, **self.__kw) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bov...@us...> - 2008-10-15 19:52:25
|
Revision: 1469 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1469&view=rev Author: boverhof Date: 2008-10-15 19:52:19 +0000 (Wed, 15 Oct 2008) Log Message: ----------- M wsdl2py/config.txt A wsdl2py/test_NoMessagePart.py A wsdl2py/wsdl/NoMessagePart.wsdl AM wsdl2py/servers/NoMessagePartServer.py unittest for [ 1803439 ] ZSI.generate.Wsdl2PythonError: must specify part for doc/lit Modified Paths: -------------- trunk/zsi/test/wsdl2py/config.txt Added Paths: ----------- trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py trunk/zsi/test/wsdl2py/test_NoMessagePart.py trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl Modified: trunk/zsi/test/wsdl2py/config.txt =================================================================== --- trunk/zsi/test/wsdl2py/config.txt 2008-05-24 01:55:33 UTC (rev 1468) +++ trunk/zsi/test/wsdl2py/config.txt 2008-10-15 19:52:19 UTC (rev 1469) @@ -38,8 +38,8 @@ test_DateService = servers/DateService.py test_FinancialService = servers/FinancialService.py test_EchoWSAddr200403 = servers/EchoWSAddr200403Server.py +test_NoMessagePart = servers/NoMessagePartServer.py - ########################################################################## # URL SECTIONS: All SOAP-1.1 # document -- document style True/False @@ -119,7 +119,7 @@ document = True literal = True broke = False -tests = test_MapPoint test_Echo test_AWSECommerceService test_FinancialService test_BasicComm test_Manufacturer test_Racing test_Attributes test_Choice test_DerivedTypes test_EchoWSAddr200403 test_SubstitutionGroup test_VIM test_Unqualified +tests = test_MapPoint test_Echo test_AWSECommerceService test_FinancialService test_BasicComm test_Manufacturer test_Racing test_Attributes test_Choice test_DerivedTypes test_EchoWSAddr200403 test_SubstitutionGroup test_VIM test_Unqualified test_NoMessagePart [doc_literal_broke] document = True @@ -184,3 +184,5 @@ test_NVOAdmin = wsdl/nvo-admin.wsdl test_Clearspace = http://eval.jivesoftware.com/clearspace/rpc/soap/BlogService?wsdl test_VIM = wsdl/vim.wsdl + +test_NoMessagePart = wsdl/NoMessagePart.wsdl Added: trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py =================================================================== --- trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py (rev 0) +++ trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py 2008-10-15 19:52:19 UTC (rev 1469) @@ -0,0 +1,45 @@ +#!/usr/bin/env python +############################################################################ +# Joshua R. Boverhof, LBNL +# See LBNLCopyright for copyright notice! +########################################################################### +import sys +from ZSI import ServiceContainer, Fault +from ZSI.ServiceContainer import AsServer, ServiceSOAPBinding +from NoMessagePartServer_server import NoMessagePartServer + +class Service(NoMessagePartServer): + def soap_Hello(self, ps, **kw): + request,response = NoMessagePartServer.soap_Hello(self, ps, **kw) + + if request is not None: + raise RuntimeException, "REQUEST SHOULD BE NONE" + response.Result = "XXX" + return request,response + + +def twisted_main(port): + from twisted.internet import reactor + from twisted.application import service, internet + from twisted.web.resource import Resource + from twisted.web.server import Site + + root = Resource() + root.putChild('test', Service()) + reactor.listenTCP(port, Site(root)) + +def main(): + port = int(sys.argv[1]) + if issubclass(NoMessagePartServer, ServiceSOAPBinding): + AsServer(port, (Service('test'),)) + return + + #from ZSI.twisted.WSresource import WSResource + #if issubclass(NoMessagePartServer, WSResource): + from twisted.internet import reactor + reactor.callWhenRunning(twisted_main, port) + reactor.run() + + +if __name__ == "__main__" : + main() Property changes on: trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py ___________________________________________________________________ Added: svn:executable + * Added: trunk/zsi/test/wsdl2py/test_NoMessagePart.py =================================================================== --- trunk/zsi/test/wsdl2py/test_NoMessagePart.py (rev 0) +++ trunk/zsi/test/wsdl2py/test_NoMessagePart.py 2008-10-15 19:52:19 UTC (rev 1469) @@ -0,0 +1,105 @@ +#!/usr/bin/env python +############################################################################ +# Joshua R. Boverhof, LBNL +# See LBNLCopyright for copyright notice! +########################################################################### +import os, sys, unittest +from ServiceTest import main, ServiceTestCase, ServiceTestSuite +from ZSI import FaultException, SoapWriter, ParsedSoap +""" +Unittest + +[ 1803439 ] ZSI.generate.Wsdl2PythonError: must specify part for doc/lit + +Date: 2008-10-15 18:42 +Sender: boverhof +Here is the offending entity: + + <wsdl:message name="HelloRequest"/> + +From +http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#WSDLMSGS + + Use of wsdl:message elements with zero parts is permitted in +Document styles to permit operations that can send or receive messages with +empty soap:Bodys. + +Basically what needs to be done here is an empty <soap:Body> is sent... + +Now only ONE operation should be able to specify an message w/o a part ( +for doc/lit ), because the wire representation of each operation MUST be +unique. + +WSDL: wsdl/NoMessagePart.wsdl +""" + +# General targets +def dispatch(): + """Run all dispatch tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_dispatch')) + return suite + +def local(): + """Run all local tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_local')) + return suite + +def net(): + """Run all network tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_net')) + return suite + +def all(): + """Run all tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_')) + return suite + + +class NoMessagePartTestCase(ServiceTestCase): + name = "test_NoMessagePart" + client_file_name = "NoMessagePartServer_client.py" + types_file_name = "NoMessagePartServer_types.py" + server_file_name = "NoMessagePartServer_server.py" + + def __init__(self, methodName): + ServiceTestCase.__init__(self, methodName) + self.wsdl2py_args.append('-b') + + def test_local_NoMessagePart(self): + ## msg = self.client_module.HelloRequest() + msg = None + rsp = self.client_module.HelloResponse() + + # Core functionality required + s = SoapWriter() + xml = str(s) + + print xml + + # Core functionality required + ps = ParsedSoap(xml) + + self.failUnless(ps.body.childNodes == 0, "Empty Body expected: " + ps.body.childNodes) + self.failUnless(ps.body_root == None, "Body root should be None: " + ps.body_root) + + pyobj = ps.Parse(None) + + self.failUnless(pyobj == None, "pyobj should be None: " + pyobj) + + + def test_dispatch_NoMessagePart(self): + loc = self.client_module.NoMessagePartServerLocator() + port = loc.getHelloServerSOAP11port_http(**self.getPortKWArgs()) + + ## NOTE: Should take no argument + rsp = port.Hello() + self.failUnless(rsp.Return == "XXX", "TODO") + + +if __name__ == "__main__" : + main() + Added: trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl =================================================================== --- trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl (rev 0) +++ trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl 2008-10-15 19:52:19 UTC (rev 1469) @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://helloserv.utbm.fr" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://helloserv.utbm.fr"> + <wsdl:documentation>HelloServer</wsdl:documentation> + <wsdl:types> + <xs:schema xmlns:ns="http://helloserv.utbm.fr" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://helloserv.utbm.fr"> + <xs:element name="HelloResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="HelloYou"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="HelloYouResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:schema> + </wsdl:types> + <wsdl:message name="HelloRequest"/> + <wsdl:message name="HelloResponse"> + <wsdl:part name="parameters" element="ns0:HelloResponse"/> + </wsdl:message> + <wsdl:message name="HelloYouRequest"> + <wsdl:part name="parameters" element="ns0:HelloYou"/> + </wsdl:message> + <wsdl:message name="HelloYouResponse"> + <wsdl:part name="parameters" element="ns0:HelloYouResponse"/> + </wsdl:message> + <wsdl:portType name="HelloServerPortType"> + <wsdl:operation name="Hello"> + <wsdl:input message="ns0:HelloRequest" wsaw:Action="urn:Hello"/> + <wsdl:output message="ns0:HelloResponse" wsaw:Action="urn:HelloResponse"/> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <wsdl:input message="ns0:HelloYouRequest" wsaw:Action="urn:HelloYou"/> + <wsdl:output message="ns0:HelloYouResponse" wsaw:Action="urn:HelloYouResponse"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="HelloServerSOAP11Binding" type="ns0:HelloServerPortType"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <wsdl:operation name="Hello"> + <soap:operation soapAction="urn:Hello" style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <soap:operation soapAction="urn:HelloYou" style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="HelloServerSOAP12Binding" type="ns0:HelloServerPortType"> + <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <wsdl:operation name="Hello"> + <soap12:operation soapAction="urn:Hello" style="document"/> + <wsdl:input> + <soap12:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap12:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <soap12:operation soapAction="urn:HelloYou" style="document"/> + <wsdl:input> + <soap12:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap12:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="HelloServerHttpBinding" type="ns0:HelloServerPortType"> + <http:binding verb="POST"/> + <wsdl:operation name="Hello"> + <http:operation location="HelloServer/Hello"/> + <wsdl:input> + <mime:content type="text/xml" part="Hello"/> + </wsdl:input> + <wsdl:output> + <mime:content type="text/xml" part="Hello"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <http:operation location="HelloServer/HelloYou"/> + <wsdl:input> + <mime:content type="text/xml" part="HelloYou"/> + </wsdl:input> + <wsdl:output> + <mime:content type="text/xml" part="HelloYou"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="NoMessagePartServer"> + <wsdl:port name="HelloServerSOAP11port_http" binding="ns0:HelloServerSOAP11Binding"> + <soap:address location="http://localhost:8080/axis2/services/HelloServer"/> + </wsdl:port> + <wsdl:port name="HelloServerSOAP12port_http" binding="ns0:HelloServerSOAP12Binding"> + <soap12:address location="http://localhost:8080/axis2/services/HelloServer"/> + </wsdl:port> + <wsdl:port name="HelloServerHttpport" binding="ns0:HelloServerHttpBinding"> + <http:address location="http://localhost:8080/axis2/services/HelloServer"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-24 01:55:25
|
Revision: 1468 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1468&view=rev Author: warnes Date: 2008-05-23 18:55:33 -0700 (Fri, 23 May 2008) Log Message: ----------- Re-fix position of import for nested scopes Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Client.py trunk/SOAPpy/SOAPpy/GSIServer.py trunk/SOAPpy/SOAPpy/NS.py trunk/SOAPpy/SOAPpy/Server.py trunk/SOAPpy/SOAPpy/Types.py Modified: trunk/SOAPpy/SOAPpy/Client.py =================================================================== --- trunk/SOAPpy/SOAPpy/Client.py 2008-05-16 23:32:51 UTC (rev 1467) +++ trunk/SOAPpy/SOAPpy/Client.py 2008-05-24 01:55:33 UTC (rev 1468) @@ -1,3 +1,5 @@ +from __future__ import nested_scopes + """ ################################################################################ # @@ -40,8 +42,6 @@ ################################################################################ """ -from __future__ import nested_scopes - ident = '$Id$' from version import __version__ Modified: trunk/SOAPpy/SOAPpy/GSIServer.py =================================================================== --- trunk/SOAPpy/SOAPpy/GSIServer.py 2008-05-16 23:32:51 UTC (rev 1467) +++ trunk/SOAPpy/SOAPpy/GSIServer.py 2008-05-24 01:55:33 UTC (rev 1468) @@ -1,3 +1,5 @@ +from __future__ import nested_scopes + """ GSIServer - Contributed by Ivan R. Judson <ju...@mc...> @@ -43,8 +45,6 @@ ################################################################################ """ -from __future__ import nested_scopes - ident = '$Id$' from version import __version__ Modified: trunk/SOAPpy/SOAPpy/NS.py =================================================================== --- trunk/SOAPpy/SOAPpy/NS.py 2008-05-16 23:32:51 UTC (rev 1467) +++ trunk/SOAPpy/SOAPpy/NS.py 2008-05-24 01:55:33 UTC (rev 1468) @@ -1,3 +1,5 @@ +from __future__ import nested_scopes + """ ################################################################################ # @@ -40,8 +42,6 @@ ################################################################################ """ -from __future__ import nested_scopes - ident = '$Id$' from version import __version__ Modified: trunk/SOAPpy/SOAPpy/Server.py =================================================================== --- trunk/SOAPpy/SOAPpy/Server.py 2008-05-16 23:32:51 UTC (rev 1467) +++ trunk/SOAPpy/SOAPpy/Server.py 2008-05-24 01:55:33 UTC (rev 1468) @@ -1,3 +1,5 @@ +from __future__ import nested_scopes + """ ################################################################################ # @@ -40,8 +42,6 @@ ################################################################################ """ -from __future__ import nested_scopes - ident = '$Id$' from version import __version__ Modified: trunk/SOAPpy/SOAPpy/Types.py =================================================================== --- trunk/SOAPpy/SOAPpy/Types.py 2008-05-16 23:32:51 UTC (rev 1467) +++ trunk/SOAPpy/SOAPpy/Types.py 2008-05-24 01:55:33 UTC (rev 1468) @@ -1,3 +1,5 @@ +from __future__ import nested_scopes + """ ################################################################################ # Copyright (c) 2003, Pfizer @@ -36,8 +38,6 @@ ident = '$Id$' from version import __version__ -from __future__ import nested_scopes - import UserList import base64 import cgi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-16 23:32:45
|
Revision: 1467 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1467&view=rev Author: warnes Date: 2008-05-16 16:32:51 -0700 (Fri, 16 May 2008) Log Message: ----------- Improve error reporting in WSDL proxy. Modified Paths: -------------- trunk/SOAPpy/SOAPpy/WSDL.py trunk/SOAPpy/tests/Makefile Removed Paths: ------------- trunk/SOAPpy/tests/translateTest.py Modified: trunk/SOAPpy/SOAPpy/WSDL.py =================================================================== --- trunk/SOAPpy/SOAPpy/WSDL.py 2008-05-16 22:02:05 UTC (rev 1466) +++ trunk/SOAPpy/SOAPpy/WSDL.py 2008-05-16 23:32:51 UTC (rev 1467) @@ -6,6 +6,8 @@ from version import __version__ import wstools +import xml +from Errors import Error from Client import SOAPProxy, SOAPAddress from Config import Config import urllib @@ -39,8 +41,15 @@ # From Mark Pilgrim's "Dive Into Python" toolkit.py--open anything. if self.wsdl is None and hasattr(wsdlsource, "read"): - #print 'stream' - self.wsdl = reader.loadFromStream(wsdlsource) + print 'stream:', wsdlsource + try: + self.wsdl = reader.loadFromStream(wsdlsource) + except xml.parsers.expat.ExpatError, e: + newstream = urllib.urlopen(wsdlsource) + buf = newstream.readlines() + raise Error, "Unable to parse WSDL file at %s: \n\t%s" % \ + (wsdlsource, "\t".join(buf)) + # NOT TESTED (as of April 17, 2003) #if self.wsdl is None and wsdlsource == '-': @@ -53,15 +62,24 @@ file(wsdlsource) self.wsdl = reader.loadFromFile(wsdlsource) #print 'file' - except (IOError, OSError): - pass - + except (IOError, OSError): pass + except xml.parsers.expat.ExpatError, e: + newstream = urllib.urlopen(wsdlsource) + buf = newstream.readlines() + raise Error, "Unable to parse WSDL file at %s: \n\t%s" % \ + (wsdlsource, "\t".join(buf)) + if self.wsdl is None: try: stream = urllib.urlopen(wsdlsource) self.wsdl = reader.loadFromStream(stream, wsdlsource) except (IOError, OSError): pass - + except xml.parsers.expat.ExpatError, e: + newstream = urllib.urlopen(wsdlsource) + buf = newstream.readlines() + raise Error, "Unable to parse WSDL file at %s: \n\t%s" % \ + (wsdlsource, "\t".join(buf)) + if self.wsdl is None: import StringIO self.wsdl = reader.loadFromString(str(wsdlsource)) Modified: trunk/SOAPpy/tests/Makefile =================================================================== --- trunk/SOAPpy/tests/Makefile 2008-05-16 22:02:05 UTC (rev 1466) +++ trunk/SOAPpy/tests/Makefile 2008-05-16 23:32:51 UTC (rev 1467) @@ -62,10 +62,10 @@ -$(PYTHON) SOAPtest.py # one subtest will fail $(PYTHON) TCtest.py $(PYTHON) testleak.py - $(PYTHON) translateTest.py - $(PYTHON) weatherTest.py - $(PYTHON) whoisTest.py - $(PYTHON) xmethods.py + -$(PYTHON) translateTest.py + -$(PYTHON) weatherTest.py + -$(PYTHON) whoisTest.py + -$(PYTHON) xmethods.py $(PYTHON) ZeroLengthArray.py testClient1: Deleted: trunk/SOAPpy/tests/translateTest.py =================================================================== --- trunk/SOAPpy/tests/translateTest.py 2008-05-16 22:02:05 UTC (rev 1466) +++ trunk/SOAPpy/tests/translateTest.py 2008-05-16 23:32:51 UTC (rev 1467) @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) 2001 actzero, inc. All rights reserved. -ident = '$Id$' - -import os, re -import sys -sys.path.insert(1, "..") - -from SOAPpy import * - -# Check for a web proxy definition in environment -try: - proxy_url=os.environ['http_proxy'] - phost, pport = re.search('http://([^:]+):([0-9]+)', proxy_url).group(1,2) - proxy = "%s:%s" % (phost, pport) -except: - proxy = None - - -if 1: - - server = WSDL.Proxy('http://www.webservicex.com/TranslateService.asmx?WSDL', - http_proxy=proxy, - ns="http://www.webservicex.com/") - - print server.show_methods() - - server.soapproxy.config.dumpHeadersOut = True - server.soapproxy.config.dumpSOAPOut = True - - server.soapproxy.config.dumpSOAPIn = True - server.soapproxy.config.dumpHeadersIn = True - - - -else: - - server = SOAPProxy("http://www.webservicex.net/TranslateService.asmx/", - http_proxy=proxy, - soapaction="http://www.webservicex.net/Translate") - - server.config.dumpHeadersOut = True - server.config.dumpSOAPOut = True - - server.config.dumpSOAPIn = True - server.config.dumpHeadersIn = True - -query = server.Translate(LanguageMode="EnglishToFrench", - Text="Hello, how are you today?") - -print query - -print repr(query) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-16 22:02:01
|
Revision: 1466 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1466&view=rev Author: warnes Date: 2008-05-16 15:02:05 -0700 (Fri, 16 May 2008) Log Message: ----------- Remove unecessary (problematic?) quotes around encoding name Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Client.py Modified: trunk/SOAPpy/SOAPpy/Client.py =================================================================== --- trunk/SOAPpy/SOAPpy/Client.py 2008-05-16 22:01:02 UTC (rev 1465) +++ trunk/SOAPpy/SOAPpy/Client.py 2008-05-16 22:02:05 UTC (rev 1466) @@ -180,7 +180,7 @@ r.putheader("User-agent", SOAPUserAgent()) t = 'text/xml'; if encoding != None: - t += '; charset="%s"' % encoding + t += '; charset=%s' % encoding r.putheader("Content-type", t) r.putheader("Content-length", str(len(data))) self.__addcookies(r); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-16 22:00:56
|
Revision: 1465 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1465&view=rev Author: warnes Date: 2008-05-16 15:01:02 -0700 (Fri, 16 May 2008) Log Message: ----------- Attempt to update translateTest to use new server. Modified Paths: -------------- trunk/SOAPpy/tests/translateTest.py Modified: trunk/SOAPpy/tests/translateTest.py =================================================================== --- trunk/SOAPpy/tests/translateTest.py 2008-05-15 23:09:30 UTC (rev 1464) +++ trunk/SOAPpy/tests/translateTest.py 2008-05-16 22:01:02 UTC (rev 1465) @@ -7,7 +7,7 @@ import sys sys.path.insert(1, "..") -from SOAPpy import SOAPProxy +from SOAPpy import * # Check for a web proxy definition in environment try: @@ -17,9 +17,38 @@ except: proxy = None -server = SOAPProxy("http://services.xmethods.com:80/perl/soaplite.cgi", - http_proxy=proxy) -babel = server._ns('urn:xmethodsBabelFish#BabelFish') -print babel.BabelFish(translationmode = "en_fr", - sourcedata = "The quick brown fox did something or other") +if 1: + + server = WSDL.Proxy('http://www.webservicex.com/TranslateService.asmx?WSDL', + http_proxy=proxy, + ns="http://www.webservicex.com/") + + print server.show_methods() + + server.soapproxy.config.dumpHeadersOut = True + server.soapproxy.config.dumpSOAPOut = True + + server.soapproxy.config.dumpSOAPIn = True + server.soapproxy.config.dumpHeadersIn = True + + + +else: + + server = SOAPProxy("http://www.webservicex.net/TranslateService.asmx/", + http_proxy=proxy, + soapaction="http://www.webservicex.net/Translate") + + server.config.dumpHeadersOut = True + server.config.dumpSOAPOut = True + + server.config.dumpSOAPIn = True + server.config.dumpHeadersIn = True + +query = server.Translate(LanguageMode="EnglishToFrench", + Text="Hello, how are you today?") + +print query + +print repr(query) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 23:09:24
|
Revision: 1464 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1464&view=rev Author: warnes Date: 2008-05-15 16:09:30 -0700 (Thu, 15 May 2008) Log Message: ----------- Add code to test Bug #1366752 Added Paths: ----------- trunk/SOAPpy/tests/Bug1366752.py Added: trunk/SOAPpy/tests/Bug1366752.py =================================================================== --- trunk/SOAPpy/tests/Bug1366752.py (rev 0) +++ trunk/SOAPpy/tests/Bug1366752.py 2008-05-15 23:09:30 UTC (rev 1464) @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +ident = '$Id: speedTest.py 243 2003-05-21 14:52:37Z warnes $' + +import time +import sys +from SOAPpy import fpconst +sys.path.insert(1, "..") + +from SOAPpy import parseSOAP, parseSOAPRPC + +env = '''<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsd2="http://www.w3.org/2000/10/XMLSchema" xmlns:xsd3="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> +%s +</SOAP-ENV:Envelope>''' + +xml = env % '''<SOAP-ENV:Body> +<result> + <_1 SOAP-ENC:arrayType="xsd:double[2]" xsi:type="SOAP-ENC:Array"> + <item>3.3</item> + <item>4.4</item> + <item>NaN</item> + <item>Inf</item> + <item>+Inf</item> + <item>Infinity</item> + <item>+Infinity</item> + <item>-Inf</item> + <item>-Infinity</item> + </_1> +</result> +</SOAP-ENV:Body>''' + + +x = parseSOAPRPC(xml)['_1'] + +assert( x[0:2] == [ 3.3, 4.4 ] ) +assert( fpconst.isNaN( x[2] ) ) +assert( fpconst.isPosInf( x[3] ) ) +assert( fpconst.isPosInf( x[4] ) ) +assert( fpconst.isPosInf( x[5] ) ) +assert( fpconst.isPosInf( x[6] ) ) +assert( fpconst.isNegInf( x[7] ) ) +assert( fpconst.isNegInf( x[8] ) ) + +print "Success" + Property changes on: trunk/SOAPpy/tests/Bug1366752.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 22:34:30
|
Revision: 1463 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1463&view=rev Author: warnes Date: 2008-05-15 15:34:37 -0700 (Thu, 15 May 2008) Log Message: ----------- Avoid relying on Python's builtin 'float(x)' function to properly handle NaN, Inf, +Inf, -Inf, resolves bug #1366752 Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Parser.py Modified: trunk/SOAPpy/SOAPpy/Parser.py =================================================================== --- trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 22:22:01 UTC (rev 1462) +++ trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 22:34:37 UTC (rev 1463) @@ -910,43 +910,38 @@ l = self.floatlimits[t[1]] s = d.strip().lower() - d = float(s) + # Explicitly check for NaN and Infinities + if s == "nan": + d = fpconst.NaN + elif s[0:2]=="inf" or s[0:3]=="+inf": + d = fpconst.PosInf + elif s[0:3] == "-inf": + d = fpconst.NegInf + else : + d = float(s) if config.strict_range: - if d < l[1]: raise UnderflowError - if d > l[2]: raise OverflowError - else: - # some older SOAP impementations (notably SOAP4J, - # Apache SOAP) return "infinity" instead of "INF" - # so check the first 3 characters for a match. - if s == "nan": - return fpconst.NaN - elif s[0:3] in ("inf", "+inf"): - return fpconst.PosInf - elif s[0:3] == "-inf": - return fpconst.NegInf - - if fpconst.isNaN(d): - if s != 'nan': - raise ValueError, "invalid %s: %s" % (t[1], s) - elif fpconst.isNegInf(d): - if s != '-inf': - raise UnderflowError, "%s too small: %s" % (t[1], s) - elif fpconst.isPosInf(d): - if s != 'inf': - raise OverflowError, "%s too large: %s" % (t[1], s) - elif d < 0 and d < l[1]: - raise UnderflowError, "%s too small: %s" % (t[1], s) - elif d > 0 and ( d < l[0] or d > l[2] ): - raise OverflowError, "%s too large: %s" % (t[1], s) - elif d == 0: - if type(self.zerofloatre) == StringType: - self.zerofloatre = re.compile(self.zerofloatre) - - if self.zerofloatre.search(s): - raise UnderflowError, "invalid %s: %s" % (t[1], s) - + if fpconst.isNaN(d): + if s[0:2] != 'nan': + raise ValueError, "invalid %s: %s" % (t[1], s) + elif fpconst.isNegInf(d): + if s[0:3] != '-inf': + raise UnderflowError, "%s too small: %s" % (t[1], s) + elif fpconst.isPosInf(d): + if s[0:2] != 'inf' and s[0:3] != '+inf': + raise OverflowError, "%s too large: %s" % (t[1], s) + elif d < 0 and d < l[1]: + raise UnderflowError, "%s too small: %s" % (t[1], s) + elif d > 0 and ( d < l[0] or d > l[2] ): + raise OverflowError, "%s too large: %s" % (t[1], s) + elif d == 0: + if type(self.zerofloatre) == StringType: + self.zerofloatre = re.compile(self.zerofloatre) + + if self.zerofloatre.search(s): + raise UnderflowError, "invalid %s: %s" % (t[1], s) return d + if t[1] in ("dateTime", "date", "timeInstant", "time"): return self.convertDateTime(d, t[1]) if t[1] == "decimal": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 22:21:55
|
Revision: 1462 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1462&view=rev Author: warnes Date: 2008-05-15 15:22:01 -0700 (Thu, 15 May 2008) Log Message: ----------- Fix typo in SOAPpy soappy.txt file, per bug 1519915 Modified Paths: -------------- trunk/pywebsvcs.sourceforge.net/soappy.txt Modified: trunk/pywebsvcs.sourceforge.net/soappy.txt =================================================================== --- trunk/pywebsvcs.sourceforge.net/soappy.txt 2008-05-15 22:19:57 UTC (rev 1461) +++ trunk/pywebsvcs.sourceforge.net/soappy.txt 2008-05-15 22:22:01 UTC (rev 1462) @@ -169,7 +169,7 @@ def hello(): return "Hello World" - server = SOAP.SOAPServer(("localhost", 8080)) + server = SOAPpy.SOAPServer(("localhost", 8080)) server.registerFunction(hello) server.serve_forever() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 22:19:50
|
Revision: 1461 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1461&view=rev Author: warnes Date: 2008-05-15 15:19:57 -0700 (Thu, 15 May 2008) Log Message: ----------- Correct separate handling of SOAP 'integer' type, which is unbounded Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Parser.py Modified: trunk/SOAPpy/SOAPpy/Parser.py =================================================================== --- trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 22:19:29 UTC (rev 1460) +++ trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 22:19:57 UTC (rev 1461) @@ -371,6 +371,12 @@ # Nothing's been added to the current frame so it must be a # simple type. +# print "cur:", cur +# print "ns:", ns +# print "attrs:", attrs +# print "kind:", kind + + if kind == None: # If the current item's container is an array, it will # have a kind. If so, get the bit before the first [, @@ -792,7 +798,7 @@ 'negative-integer': (0, None, -1), 'long': (1, -9223372036854775808L, 9223372036854775807L), - 'int': (0, -2147483648L, 2147483647), + 'int': (0, -2147483648L, 2147483647L), 'short': (0, -32768, 32767), 'byte': (0, -128, 127), 'nonNegativeInteger': (0, 0, None), @@ -854,8 +860,18 @@ #print " requested_type=", t #print " data=", d + +# print "convertToBasicTypes:" +# print " requested_type=", t +# print " data=", d +# print " attrs=", attrs +# print " t[0]=", t[0] +# print " t[1]=", t[1] + +# print " in?", t[0] in NS.EXSD_L + if t[0] in NS.EXSD_L: - if t[1] in ["int", "integer"]: + if t[1]=="integer": # unbounded integer type try: d = int(d) if len(attrs): @@ -863,7 +879,7 @@ except: d = long(d) return d - if self.intlimits.has_key (t[1]): # integer types + if self.intlimits.has_key (t[1]): # range-bounded integer types l = self.intlimits[t[1]] try: d = int(d) except: d = long(d) @@ -883,7 +899,7 @@ return str(dnn) except: return dnn - if t[1] in ["bool", "boolean"]: + if t[1] in ("bool", "boolean"): d = d.strip().lower() if d in ('0', 'false'): return False This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 22:19:22
|
Revision: 1460 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1460&view=rev Author: warnes Date: 2008-05-15 15:19:29 -0700 (Thu, 15 May 2008) Log Message: ----------- Correct separate handling of SOAP 'integer' type, which is unbounded Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Types.py Modified: trunk/SOAPpy/SOAPpy/Types.py =================================================================== --- trunk/SOAPpy/SOAPpy/Types.py 2008-05-15 22:18:12 UTC (rev 1459) +++ trunk/SOAPpy/SOAPpy/Types.py 2008-05-15 22:19:29 UTC (rev 1460) @@ -1119,7 +1119,7 @@ if type(data) not in (IntType, LongType) or \ data < -2147483648L or \ - data > 2147483647: + data > 2147483647L: raise ValueError, "invalid %s value" % self._type return data @@ -1313,9 +1313,15 @@ else: self.__dict__[name][subpos] = value - self._keyord[pos] = name + # only add to key order list if it does not already + # exist in list + if not (name in self._keyord): + if pos < len(x): + self._keyord[pos] = name + else: + self._keyord.append(name) + - def _getItemAsList(self, name, default = []): try: d = self.__dict__[name] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 22:18:05
|
Revision: 1459 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1459&view=rev Author: warnes Date: 2008-05-15 15:18:12 -0700 (Thu, 15 May 2008) Log Message: ----------- Add test case for Bug #193688. SOAPpy is losing attributes on basic types Added Paths: ----------- trunk/SOAPpy/tests/Bug1936883.py Added: trunk/SOAPpy/tests/Bug1936883.py =================================================================== --- trunk/SOAPpy/tests/Bug1936883.py (rev 0) +++ trunk/SOAPpy/tests/Bug1936883.py 2008-05-15 22:18:12 UTC (rev 1459) @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +ident = '$Id: speedTest.py 243 2003-05-21 14:52:37Z warnes $' + +import time +import sys +sys.path.insert(1, "..") + +from SOAPpy import parseSOAP, parseSOAPRPC + +env = '''<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsd2="http://www.w3.org/2000/10/XMLSchema" xmlns:xsd3="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> +%s +</SOAP-ENV:Envelope>''' + +xml = env % '''<SOAP-ENV:Body> +<_1 SOAP-ENC:arrayType="xsd:int[4]" SOAP-ENC:offset="[2]" xsi:type="SOAP-ENC:Array"> + <_2 SOAP-ENC:arrayType="xsd:int[2]" xsi:type="SOAP-ENC:Array"> + <item>1</item> + <item>2</item> + </_2> + <_3 SOAP-ENC:arrayType="xsd:double[2]" xsi:type="SOAP-ENC:Array"> + <item>3.3</item> + <item>4.4</item> + </_3> + <_4 SOAP-ENC:arrayType="xsd:bool[2]" xsi:type="SOAP-ENC:Array"> + <item>0</item> + <item>1</item> + </_4> + <_5 SOAP-ENC:arrayType="xsd:bool[2]" xsi:type="SOAP-ENC:Array"> + <item>False</item> + <item>True</item> + </_5> +</_1> +</SOAP-ENV:Body>''' + + +x = parseSOAPRPC(xml) + + +assert( x[2] == [ 1, 2 ] ) +assert( x[3] == [ 3.3, 4.4 ] ) + +# These previously failed, instead having strings +assert( x[4] == [ False, True ] ) +assert( x[5] == [ False, True ] ) + +print "Success" + Property changes on: trunk/SOAPpy/tests/Bug1936883.py ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 22:17:05
|
Revision: 1458 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1458&view=rev Author: warnes Date: 2008-05-15 15:17:12 -0700 (Thu, 15 May 2008) Log Message: ----------- Add test case for Bug #193688. SOAPpy is losing attributes on basic types Added Paths: ----------- trunk/SOAPpy/tests/Bug1356261.py Added: trunk/SOAPpy/tests/Bug1356261.py =================================================================== --- trunk/SOAPpy/tests/Bug1356261.py (rev 0) +++ trunk/SOAPpy/tests/Bug1356261.py 2008-05-15 22:17:12 UTC (rev 1458) @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +ident = '$Id: SOAPtest.py,v 1.19 2004/04/01 13:25:46 warnes Exp $' + +import urllib +import sys +import unittest +import re + +sys.path.insert(1, "..") +from SOAPpy import * +config=Config +config.strict_range=1 + + +class SOAPTestCase(unittest.TestCase): + def testAttributes(self): + x = '''<?xml version="1.0" encoding="utf-8"?> +<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> +<SomeMethod> +<Result> +<Book> + <title some_attr='some_value'>My Life and Work</title> +</Book> +<Person> + <name>Henry Ford</name> + <age> 49 </age> + <height> 5.5 </height> +</Person> +</Result> +</SomeMethod> +</soap:Body> +</soap:Envelope> +''' + # parse rules + y = parseSOAPRPC(x) + self.assertEquals(y.Result.Book.title._attrs[(None, 'some_attr')], 'some_value'); + +if __name__ == '__main__': + unittest.main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 19:04:32
|
Revision: 1457 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1457&view=rev Author: warnes Date: 2008-05-15 12:04:23 -0700 (Thu, 15 May 2008) Log Message: ----------- Correct error in handling time objects, per bug report and patch provided by Mark Holder, #1776459 Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Types.py Modified: trunk/SOAPpy/SOAPpy/Types.py =================================================================== --- trunk/SOAPpy/SOAPpy/Types.py 2008-05-15 18:53:06 UTC (rev 1456) +++ trunk/SOAPpy/SOAPpy/Types.py 2008-05-15 19:04:23 UTC (rev 1457) @@ -592,9 +592,10 @@ def _marshalData(self): if self._cache == None: d = self._data - s = '' - - s = time.strftime("%H:%M:%S", (0, 0, 0) + d + (0, 0, -1)) + #s = '' + # + #s = time.strftime("%H:%M:%S", (0, 0, 0) + d + (0, 0, -1)) + s = "%02d:%02d:%02d" % d f = d[2] - int(d[2]) if f != 0: s += ("%g" % f)[1:] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 18:53:09
|
Revision: 1456 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1456&view=rev Author: warnes Date: 2008-05-15 11:53:06 -0700 (Thu, 15 May 2008) Log Message: ----------- Fix handling of boolean arrays, bug #1936883 Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Parser.py trunk/SOAPpy/tests/Makefile Modified: trunk/SOAPpy/SOAPpy/Parser.py =================================================================== --- trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 17:20:09 UTC (rev 1455) +++ trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 18:53:06 UTC (rev 1456) @@ -855,7 +855,7 @@ #print " data=", d if t[0] in NS.EXSD_L: - if t[1] == "integer": + if t[1] in ["int", "integer"]: try: d = int(d) if len(attrs): @@ -883,7 +883,7 @@ return str(dnn) except: return dnn - if t[1] == "boolean": + if t[1] in ["bool", "boolean"]: d = d.strip().lower() if d in ('0', 'false'): return False Modified: trunk/SOAPpy/tests/Makefile =================================================================== --- trunk/SOAPpy/tests/Makefile 2008-05-15 17:20:09 UTC (rev 1455) +++ trunk/SOAPpy/tests/Makefile 2008-05-15 18:53:06 UTC (rev 1456) @@ -4,7 +4,7 @@ card independent \ testClient1 outside_services -bugs: Bug1001646 Bug916265 Bug1161780 +bugs: Bug1001646 Bug916265 Bug1161780 Bug1936883 echoClient: $(PYTHON) echoServer.py >& echoServer_echoClient.log & @@ -31,6 +31,9 @@ $(PYTHON) esj_test_client.py +Bug1936883: + $(PYTHON) Bug1936883.py + Bug1161780: $(PYTHON) Bug1161780.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 17:20:09
|
Revision: 1455 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1455&view=rev Author: warnes Date: 2008-05-15 10:20:09 -0700 (Thu, 15 May 2008) Log Message: ----------- Add type attribute to soapfault tags, per patch submitted by Stefan on bug report #1326686 Modified Paths: -------------- trunk/SOAPpy/SOAPpy/SOAPBuilder.py Modified: trunk/SOAPpy/SOAPpy/SOAPBuilder.py =================================================================== --- trunk/SOAPpy/SOAPpy/SOAPBuilder.py 2008-05-15 17:14:15 UTC (rev 1454) +++ trunk/SOAPpy/SOAPpy/SOAPBuilder.py 2008-05-15 17:20:09 UTC (rev 1455) @@ -541,10 +541,9 @@ if isinstance(obj, faultType): # Fault cns, cdecl = self.genns(ns_map, NS.ENC) vns, vdecl = self.genns(ns_map, NS.ENV) - self.out.append('''<%sFault %sroot="1"%s%s> -<faultcode>%s</faultcode> -<faultstring>%s</faultstring> -''' % (vns, cns, vdecl, cdecl, obj.faultcode, obj.faultstring)) + self.out.append('<%sFault %sroot="1"%s%s>' % (vns, cns, vdecl, cdecl)) + self.dump(obj.faultcode, "faultcode", typed, ns_map) + self.dump(obj.faultstring, "faultstring", typed, ns_map) if hasattr(obj, "detail"): self.dump(obj.detail, "detail", typed, ns_map) self.out.append("</%sFault>\n" % vns) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 17:14:42
|
Revision: 1454 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1454&view=rev Author: warnes Date: 2008-05-15 10:14:15 -0700 (Thu, 15 May 2008) Log Message: ----------- Attempt to fix bug report 1238095 Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Server.py Modified: trunk/SOAPpy/SOAPpy/Server.py =================================================================== --- trunk/SOAPpy/SOAPpy/Server.py 2008-05-15 17:02:00 UTC (rev 1453) +++ trunk/SOAPpy/SOAPpy/Server.py 2008-05-15 17:14:15 UTC (rev 1454) @@ -558,7 +558,7 @@ self.connection.shutdown(1) def do_GET(self): - + #print 'command ', self.command #print 'path ', self.path #print 'request_version', self.request_version @@ -567,7 +567,7 @@ #print ' maintype', self.headers.maintype #print ' subtype ', self.headers.subtype #print ' params ', self.headers.plist - + path = self.path.lower() if path.endswith('wsdl'): method = 'wsdl' @@ -581,7 +581,7 @@ l = method.split(".") for i in l: function = getattr(function, i) - + if function: self.send_response(200) self.send_header("Content-type", 'text/plain') @@ -589,7 +589,7 @@ response = apply(function, ()) self.wfile.write(str(response)) return - + # return error self.send_response(200) self.send_header("Content-type", 'text/html') @@ -613,8 +613,8 @@ </body>''') + - def log_message(self, format, *args): if self.server.log: BaseHTTPServer.BaseHTTPRequestHandler.\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2008-05-15 17:02:07
|
Revision: 1453 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1453&view=rev Author: warnes Date: 2008-05-15 10:02:00 -0700 (Thu, 15 May 2008) Log Message: ----------- Fix error handling when an unexpected tag is encounterd outside the SOAP body. Modified Paths: -------------- trunk/SOAPpy/SOAPpy/Parser.py trunk/SOAPpy/tests/Bug1161780.py trunk/SOAPpy/tests/Makefile Modified: trunk/SOAPpy/SOAPpy/Parser.py =================================================================== --- trunk/SOAPpy/SOAPpy/Parser.py 2008-05-14 21:36:32 UTC (rev 1452) +++ trunk/SOAPpy/SOAPpy/Parser.py 2008-05-15 17:02:00 UTC (rev 1453) @@ -85,6 +85,16 @@ self._rules = rules def startElementNS(self, name, qname, attrs): + + def toStr( name ): + prefix = name[0] + tag = name[1] + if self._prem_r.has_key(prefix): + tag = self._prem_r[name[0]] + ':' + name[1] + elif prefix: + tag = prefix + ":" + tag + return tag + # Workaround two sax bugs if name[0] == None and name[1][0] == ' ': name = (None, name[1][1:]) @@ -95,8 +105,8 @@ if self._next == "E": if name[1] != 'Envelope': - raise Error, "expected `SOAP-ENV:Envelope', gto `%s:%s'" % \ - (self._prem_r[name[0]], name[1]) + raise Error, "expected `SOAP-ENV:Envelope', " \ + "got `%s'" % toStr( name ) if name[0] != NS.ENV: raise faultType, ("%s:VersionMismatch" % NS.ENV_T, "Don't understand version `%s' Envelope" % name[0]) @@ -108,16 +118,17 @@ else: raise Error, \ "expected `SOAP-ENV:Header' or `SOAP-ENV:Body', " \ - "got `%s'" % self._prem_r[name[0]] + ':' + name[1] + "got `%s'" % toStr( name ) elif self._next == "B": if name == (NS.ENV, "Body"): self._next = None else: - raise Error, "expected `SOAP-ENV:Body', got `%s'" % \ - self._prem_r[name[0]] + ':' + name[1] + raise Error, "expected `SOAP-ENV:Body', " \ + "got `%s'" % toStr( name ) elif self._next == "": - raise Error, "expected nothing, got `%s'" % \ - self._prem_r[name[0]] + ':' + name[1] + raise Error, "expected nothing, " \ + "got `%s'" % toStr( name ) + if len(self._stack) == 2: rules = self._rules Modified: trunk/SOAPpy/tests/Bug1161780.py =================================================================== --- trunk/SOAPpy/tests/Bug1161780.py 2008-05-14 21:36:32 UTC (rev 1452) +++ trunk/SOAPpy/tests/Bug1161780.py 2008-05-15 17:02:00 UTC (rev 1453) @@ -1,9 +1,10 @@ #!/usr/bin/env python import sys -sys.path = ["/home/tim/SOAPpy-0.12.0"] \ - + sys.path +sys.path.insert(1, "..") +from SOAPpy.Errors import Error from SOAPpy.Parser import parseSOAPRPC -bad = """<?xml version="1.0"?> + +original = """<?xml version="1.0"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" @@ -15,4 +16,13 @@ <ErrorString>The CustomerID tag could not be found or the number contained in the tag was invalid</ErrorString></SOAP-ENV:Envelope> """ -parseSOAPRPC(bad, attrs = 1) + +try: + parseSOAPRPC(original, attrs = 1) +except Error, e: + if e.msg != "expected nothing, got `ErrorString'": + raise AssertionError, "Incorrect error message generated: " + e.msg +else: + raise AssertionError, "Incorrect error message generated" + +print "Success" Modified: trunk/SOAPpy/tests/Makefile =================================================================== --- trunk/SOAPpy/tests/Makefile 2008-05-14 21:36:32 UTC (rev 1452) +++ trunk/SOAPpy/tests/Makefile 2008-05-15 17:02:00 UTC (rev 1453) @@ -1,9 +1,11 @@ PYTHON=python -default: echoClient echoHeader largeDataTest Bug1001646 Bug916265 \ +default: echoClient echoHeader largeDataTest bugs \ card independent \ testClient1 outside_services +bugs: Bug1001646 Bug916265 Bug1161780 + echoClient: $(PYTHON) echoServer.py >& echoServer_echoClient.log & sleep 5s # wait for server to start up @@ -29,6 +31,9 @@ $(PYTHON) esj_test_client.py +Bug1161780: + $(PYTHON) Bug1161780.py + Bug1001646: $(PYTHON) echoServer.py >& echoServer_largeDataTest.log & sleep 5s # wait for server to start up @@ -50,7 +55,7 @@ independent: $(PYTHON) speedTest.py $(PYTHON) Bug918216.py - $(PYTHON) ComplexTypes.py + -$(PYTHON) ComplexTypes.py -$(PYTHON) SOAPtest.py # one subtest will fail $(PYTHON) TCtest.py $(PYTHON) testleak.py This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |