Filed bug #2894298!
Thanks.
yiping
On Sun, Nov 8, 2009 at 9:20 AM, Joshua Boverhof <jrboverhof@...> wrote:
> Looks like a valid patch. Please submit a bug report.
>
> thanks,
> -josh
>
> On Nov 7, 2009, at 4:15 PM, Yiping Zhang wrote:
>
> I have to apply following patch to TC.py to get rid of that stack trace:
>
> --- TC.py 2009-11-07 15:50:04.000000000 -0800
> +++ TC_new.py 2009-11-07 15:48:40.000000000 -0800
> @@ -1336,8 +1336,11 @@
> return
>
> # Namespace if element AnyType was namespaced.
> - what.serialize(elt, sw, pyobj,
> - name=(self.nspname or what.nspname, self.pname or what.pname),
> **kw)
> + if 'name' in kw:
> + what.serialize(elt, sw, pyobj, **kw)
> + else:
> + what.serialize(elt, sw, pyobj,
> + name=(self.nspname or what.nspname, self.pname or
> what.pname), **kw)
>
> def parse(self, elt, ps):
> #element name must be declared ..
>
> In my case, kw = {'name' : 'item'}, and name = (None, None), so original
> call to "what.serialize()" has "name" argument used twice.
>
> Now, I don't claim to fully understand how class AnyType(TypeCode) works,
> so I can't be certain that above patch is appropriate, but at least it
> solved my problem and in the context of my application I don't see any ill
> effect of it.
>
> It would be nice if any ZSI core developers could provide some insights to
> how this class works and if above patch is indeed appropriate.
>
> Thanks,
>
> Yiping
>
> On Tue, Nov 3, 2009 at 3:50 PM, Yiping Zhang <yiping4698@...> wrote:
>
>> Hi, Josh,
>>
>> Thanks for your reply.
>>
>> Not sure if I am doing it wrong, but I am getting a stack trace now.
>>
>> here are my changes::
>>
>> class MyDateTuple(tuple):
>> typecode = ZSI.TCtime.gDateTime()
>>
>> timestamp = MyDateTuple((2009,11,1,12,0,0,0,0,0))
>>
>> ...
>>
>> flexFields.set_element_values([timestamp])
>>
>> When script was run, I got following traceback:
>>
>>
>> Traceback (most recent call
>> last):
>> File "src/bin/apitool", line 145, in
>> ?
>>
>> CmdProcessor(ctf_sess).cmdloop(__welcome__)
>>
>> File "/usr/lib64/python2.4/cmd.py", line 142, in
>> cmdloop
>> stop =
>> self.onecmd(line)
>>
>> File "/usr/lib64/python2.4/cmd.py", line 218, in
>> onecmd
>> return
>> self.default(line)
>>
>> File "/u1/src/py-ctf/src/TeamForge/CmdProcessor.py", line 93, in
>> default
>> ApiMethods[this_cmd](self.session, this_cmd,
>> arg_list).run()
>> File "/u1/src/py-ctf/src/TeamForge/Services/TrackerApp.py", line 60, in
>> __init__
>>
>> self.action()
>>
>> File "/u1/src/py-ctf/src/TeamForge/Services/TrackerApp.py", line 156, in
>> action
>> response = getattr(self.port,
>> self.cmd)(self.request)
>> File
>> "/u1/src/py-ctf/src/TeamForge/Soap50/TrackerApp/TrackerAppSoapService_services.py",
>> line 373, in
>> createArtifact2
>>
>> self.binding.Send(None, None, request, soapaction="", encodingStyle="
>> http://schemas.xmlsoap.org/soap/encoding/",
>> **kw)
>>
>> File "/usr/lib/python2.4/site-packages/ZSI/client.py", line 224, in
>> Send
>> sw.serialize(obj,
>> tc)
>>
>> File "/usr/lib/python2.4/site-packages/ZSI/writer.py", line 117, in
>> serialize
>> elt = typecode.serialize(self.body, self, pyobj, **kw)
>> File "/usr/lib/python2.4/site-packages/ZSI/TC.py", line 610, in
>> serialize
>> pyobj.typecode.serialize(elt, sw, pyobj, **kw)
>> File "/usr/lib/python2.4/site-packages/ZSI/TCcompound.py", line 273, in
>> serialize
>> self.cb(elt, sw, pyobj, name=name, **kw)
>> File "/usr/lib/python2.4/site-packages/ZSI/TCcompound.py", line 422, in
>> cb
>> what.serialize(elem, sw, v, **kw)
>> File "/usr/lib/python2.4/site-packages/ZSI/TCcompound.py", line 273, in
>> serialize
>> self.cb(elt, sw, pyobj, name=name, **kw)
>> File "/usr/lib/python2.4/site-packages/ZSI/TCcompound.py", line 422, in
>> cb
>> what.serialize(elem, sw, v, **kw)
>> File "/usr/lib/python2.4/site-packages/ZSI/TCcompound.py", line 662, in
>> serialize
>> for e in pyobj[offset:]: self.ofwhat.serialize(el, sw, e, **d)
>> File "/usr/lib/python2.4/site-packages/ZSI/TC.py", line 1340, in
>> serialize
>> name=(self.nspname or what.nspname, self.pname or what.pname), **kw)
>> TypeError: serialize() got multiple values for keyword argument 'name'
>>
>>
>> What did I do wrong this time?
>>
>> Yiping
>>
>>
>>
>> On Mon, Nov 2, 2009 at 7:54 PM, Joshua Boverhof <jrboverhof@...:
>>
>>> ZSI sees a tuple and interprets it as an array. If you want the tuple to
>>> be interpreted as a dateTime instance you need to wrap it and add a typecode
>>> attribute to it.
>>>
>>> Something like this:
>>>
>>> class MyDateTuple(tuple):
>>> typecode = ZSI.TCtime.gDateTime()
>>>
>>>
>>> timestamp = MyDateTuple((2009, .....
>>>
>>>
>>> Or you may have a typecode already generated for by wsdl2py...
>>>
>>> -josh
>>>
>>>
>>>
>>> On Oct 31, 2009, at 6:26 PM, Yiping Zhang wrote:
>>>
>>> Hi, there,
>>>
>>> I have some trouble adding a dateTime object to an anyType[] array.
>>> Normally, a dateTime object is represented as a tuple of nine int, such as:
>>>
>>> timestamp = (2009, 10, 31, 10, 0, 0, 0, 0, 0)
>>>
>>> But when I try to add such an object to an anyType[] array like
>>> following:
>>>
>>> flexFields.set_element_values([timestamp])
>>>
>>> I receive an exception with error message "org.xml.sax.SAXException: No
>>> deserializer for {http://www.w3.org/2001/XMLSchema}anyType<http://www.w3.org/2001/XMLSchema%7DanyType>
>>> ".
>>>
>>> Looking at the soap trace file, what I sent over the wire is totally
>>> unexpected:
>>>
>>> (removed extra irrelevant stuff from soap trace output)
>>>
>>> <values arrayType="xsd:anyType[]">
>>> <item>
>>> <Eof13b718 id="of13b718" type="xsd:int">2009</Eof13b718>
>>> <Eoe845490 id="oe845490" type="xsd:int">10</Eoe845490>
>>> <Eoe8452b0 id="oe8452b0" type="xsd:int">30</Eoe8452b0>
>>> <Eoe8454d8 id="oe8454d8" type="xsd:int">10</Eoe8454d8>
>>> <Eoe845580 id="oe845580" type="xsd:int">0</Eoe845580>
>>> <Eoe845580 href="#oe845580"/>
>>> <Eoe845580 href="#oe845580"/>
>>> <Eoe845580 href="#oe845580"/>
>>> <Eoe845580 href="#oe845580"/>
>>> </item>
>>> </values>
>>>
>>> Obviously, my assignment is wrong, but how to do it right ?
>>>
>>> Thanks for all the helps,
>>>
>>> yiping
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>>
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>>
>>> http://p.sf.net/sfu/devconference_______________________________________________
>>> Pywebsvcs-talk mailing list
>>> Pywebsvcs-talk@...
>>> https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk
>>> Also archived at http://groups.google.com/group/pywebsvcs
>>>
>>>
>>>
>>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.
> http://p.sf.net/sfu/bobj-july_______________________________________________
>
> Pywebsvcs-talk mailing list
> Pywebsvcs-talk@...
> https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk
> Also archived at http://groups.google.com/group/pywebsvcs
>
>
>
|