SEARCH YOUR SOLUTION HERE  

ZSI receiving complex type problem

I have a ZSI client talking to a perl program through SOAP. The perl
program has defined a return type of $esmith::recExtend, where
esmith::recExtend is a complex type defined in the WSDL as follows:















The perl method returns an esmith::recExtend object as follows:

$record = esmith::recExtend->new('dbname, $dbkey, \@prop, \@value,
$size);
return SOAP:ata->name('get_recordReturn' => $record);

The ZSI file is expecting an EsmithRecExtend object to be returned in
get_recordReturn. However, executing the above code causes the
following error:

ZSI.EvaluationException: No Registered xsi:type=
(http://namespaces.soaplite.com/perl, esmith__recExtend), subsititue
for xsi:type=(http://localhost:esmith/SOAPWrapper, EsmithRecExtend)

If I return SOAP:ata->name('get_recordReturn' => $record)-
>type('http://localhost:/esmith/SOAPWrapper:EsmithRecExtend),
then a TypeError: unpack non sequence exception is thrown.

I believe that the TypeError: unpack non sequence is resulting because
the ZSI attempts to seperate the type into (namespace, type) with the
division between the two defined by the ' : ' character, which is
found
more than once in the given namespace.

Does anyone have any ideas on how to resolve this issue

What do I do to return the complex type and have the
ZSI client understand it

Posted On: Wednesday 7th of November 2012 01:07:19 PM Total Views:  268
View Complete with Replies




Related Messages:

sorting list of complex numbers   (73 Views)
The thread on sorting in Python 3 got me to thinking. How could I sort a list of complex numbers using key >>> lst = [random.random()+random.random()*1j for i in range(10)] >>> lst [(0.32672251849959244+0.41428983433288791j), (0.35238056484609881+0.92758203977208264j), (0.19337824038125528+0.16527285180541951j), (0.47569307114525849+0.72381960418815128j), (0.21498813135082351+0.2046308266222292j), (0.30142745756937939+0.35216751451102601j), (0.77355676386939132+0.0023447924287695043j), (0.2547736124606309+0.52234837788936905j), (0.38349189081350132+0.62017617694427096j), (0.58362096773561245+0.87702443273108477j)] As expected: >>> sorted(lst) Traceback (most recent call last): File "", line 1, in TypeError: no ordering relation is defined for complex numbers This works: >>> sorted(lst, key=lambda x: x.real) [(0.19337824038125528+0.16527285180541951j), (0.21498813135082351+0.2046308266222292j), (0.2547736124606309+0.52234837788936905j), (0.30142745756937939+0.35216751451102601j), (0.32672251849959244+0.41428983433288791j), (0.35238056484609881+0.92758203977208264j), (0.38349189081350132+0.62017617694427096j), (0.47569307114525849+0.72381960418815128j), (0.58362096773561245+0.87702443273108477j), (0.77355676386939132+0.0023447924287695043j)] but what if I want to sort by real, then imaginary parts Here's a longer list with 20 elements where there are only 10 distinct reals but 20 distinct imaginaries: >>> pprint.pprint(lst) [(1+2.73j), (9+3.77j), (7+27j), (8+28j), (2+2.8600000000000003j), (4+3.1200000000000001j), (2+22j), (9+29j), (3+2.9900000000000002j), (6+26j), 2.6000000000000001j, (8+3.6400000000000001j), (3+23j), (5+3.25j), (1+21j), (5+25j), 20j, (6+3.3799999999999999j), (7+3.5100000000000002j), (4+24j)] I can sort by the real parts just fine: >>> lst.sort(key=lambda x: x.real) >>> pprint.pprint(lst) [2.6000000000000001j, 20j, (1+2.73j), (1+21j), (2+2.8600000000000003j), (2+22j), (3+2.9900000000000002j), (3+23j), (4+3.1200000000000001j), (4+24j), (5+3.25j), (5+25j), (6+26j), (6+3.3799999999999999j), (7+27j), (7+3.5100000000000002j), (8+28j), (8+3.6400000000000001j), (9+3.77j), (9+29j)] but how do I then do a secondary sort by the imaginary part, preserving the existing ordering on the real parts Seems like I have to resort to a Schwartzian transform and map the complex numbers to tuples, sort that, then map them back. With the cmp key it would have been a fairly trivial task to define the deed compare-real-then-imag function. Is there a way to do this using just the key arg, no extra data structures Skip
Re: complex representation   (91 Views)
DSM wrote: > ISTM the same reasoning applies equally to complex numbers. My interest > arose because of what I think is a bug in pypy's complex printing: > > > Python 2.4.1 (pypy 1.0.0 build 56124) on linux2 > Type "help", "copyright", "credits" or "license" for more information. > ``RPython: we use it so you don't have to'' > >>>> (1.1+1.1j)**200 > (240733537691613523198532543387690598400L+236495565429619338248192Lj) > > > This strangeness comes about because a hack used to recover cpython's > behaviour fails at large values. (x.real == floor(x.real), so it > decides the value's an integer, and returns the repr of int(x.real).) > It's trivial to fix but I think cpython's behaviour is slightly odd > here, and the real and imaginary parts of the complex repr should be > identical to those of the underlying floats. CPython 2.4, 2.5, and 3.0 on WinXP (and hence I presume 2.6) produce (with a trivial variation) >>> (1.1+1.1j)**200 (2.407335376916204e+38+2.3649556542962612e+23j) That Pypy disagrees in the 14th digit is a bit odd, but I suspect a C math library difference. Unless they are actually calculating 40 digits exactly, the extra digits should be filled with 0s if they want integers. Take that, and whatever you think is strange, up with them.
complex numbers should respect the "I" representation   (67 Views)
hi I think complex numbers should respect the "i" or "I" representation, instead of "j". No reason being cute and using a different character instead of the traditional representation At least have the decency of supporting the orginal representation Programmers use j as frequently as i as indexing variable, I see no reason choosing "j" over "i". Have some respect for majority's rules. This is childish.
Re: Problem with complex numbers   (76 Views)
"Christian Heimes" wrote in message news:47E58836.70202@cheimes.de... | Well, the file is in the Demo folder. It's just a demo how to implement a naive complex type in Python. | Why do you think the power of a complex to a complex is not defined I suspect because the naive implementation raise TypeError for that case.
Re: at what complexity, a comparison fails ?   (83 Views)
Robert Kern wrote: > Stef Mientki wrote: > >> hello, >> >> I had a program that worked perfectly well. >> In this program modules were dynamically added, >> just by putting the file in a predefined directory. >> >> Now one of the interface mechanisms was to see if some parameter was >> changed in a an instance, >> by comparing the value from the instance with its previous value >> >> This went all well, untill I added a too complex variable, >> then the program stopped working, without generating exceptions. >> >> So it seems that comparing a too complex value isn't allowed. >> the variable was something like: >> >> A = [ , , ..., [,,...], [, >> , ... ] ] >> >> So what I need was something like: >> if A != A_prev : >> ... do something >> A_prev = A >> >> And this crashes, or at least it doesn't work but also doesn't generate >> exceptions. >> It does seems to work, if A only contains 1 array. >> >> Why am I not allowed to compare A and A_prev >> And in general, how complex might a list be to make a valid comparison, >> or what are the rules >> > > Remember that numpy arrays use rich comparisons. (ndarray1 != ndarray2) gives > another array, not a boolean value. The resulting array cannot be used in an > "if" clause. > > thanks , I'm glad that Python behaves as expected and can compare complex structures ;-) Robert you hit the nail right on its head, indeed I should be quit carefully with numpy arrays. cheers, Stef Mientki
Re: So what exactly is a complex number?   (89 Views)
On 8/31/07, Carsten Haese wrote: > On Thu, 2007-08-30 at 20:11 -0500, Lamonte Harris wrote: > > Like in math where you put letters that represent numbers for place > > holders to try to find the answer type complex numbers > > Is English your native language I'm having a hard time decoding your > question. > I'm pretty sure he was describing middle school algebra.
Re: So what exactly is a complex number?   (82 Views)
> So what exactly is a complex number It is a math construct, and has almost nothing to do with Python, other than the fact that Python has a data type for them. So, here is a list of better ways to get information about complex numbers than asking python-list: 1. Google it: http://www.google.com/searchq=Complex+Numbers 2. Wikipedia: See the first result of the above 3. Ask a math teacher 4. Just stay in school and do your math homework. You will learn about it eventually.
Problem from complex string messing up   (87 Views)
I have these bunch of html files from which I've stripped presentation with BeautifulSoup (only kept a content div with the bare content). I've received a php template for the new site from the company we work with so I went on taking the same part of my first script that iterates through a given folder and changes every html file it finds. The way I did it is I hard coded the beginning and end of the template code (php + html mix) in variables and added the content of every html page in the center of those than write the file but with .php instead of .html and removing the .html version. I've hard coded the template code because I found it easier this way (and this script had to be done really fast) I used triple quotes """template code""" to avoid problems, but every file touched by the script end up having a problem and not being able the show the supposed drop down menu. Now the code the company did for this drop down is pretty esoteric: /* qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts,qm_la;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&window.XMLHttpRequest;var qm_n=qm_t.indexOf("Netscape") +1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,nf,l){var w="onmouseover";if(oc) {w="onclick";th=0;ts=0;}if(!l) {l=1;qm_th=th;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e) {qm_kille(e)};document[w]=qm_bo;sd.style.zoom=1;if(sh)x2("qmsh",sd, 1);if(!v)sd.ch=1;}else if(sh)sd.ch=1;if(sh)sd.sh=1;if(fl)sd.fl=1;if(rl)sd.rl=1;sd.style.zIndex=l +""+1;var lsp;var sp=sd.childNodes;for(var i=0;i
[pyserial - winXP] Serial port stop receiving data after a few hours, raise no error   (77 Views)
> My soft passively listen to a device sending +- 300 bytes of data each > second. After several hours of work, the soft abruptly stops receiving > data without any error, (while the device sends properly, of course) > and I need to restart it (the python soft) to "reactivate" the ports. > > I read that when the serial port encounters an error (frame error or > so, I imagine) it stop receiving data until the library function > "getCommError()" is called. > > Am I on the good track Can I call this function from my pyserial > code > > Why pyserial does'nt raise a serial.SerialException in this case > > Notes: > --------- > I'm not working with plain serial ports, I use serial over USB (FTDI > or so) and serial over Ethernet (moxa.com). > I'm in 115k 8N1 and I use 4 ports simultaneously > I use python 2.4 with pyserial 2.2 on Windows XP. Late thanks for your both answers! (Please excuse me for that) The problem was a bug in the device firmware. But before finding this, I dugg lightly in the pyserial source and found (to take with care!) : + getCommError(...) is () no more implemented in the win32 API (it was in the win16 API) ; it is replaced by GetCommState(...) ; pyserial use GetCommState(...) in _reconfigurePort() + pyserial use ClearCommError in the functions read(...) and inWaiting(...) ; it takes somewhat different arguments than GetCommState(...) but return the same () info AND clear the errors (getcomm(Error|State) doesn't ()). + the errors on the serial flow (overrun and so) seem just cleared away and not followed to the application by pyserial. PA the links : delta win 16/32 on msdn : http://msdn2.microsoft.com/en-us/library/aa383678.aspx GetCommState() on msdn : http://msdn2.microsoft.com/en-us/library/aa363260.aspx ClearCommError() on msdn : http://msdn2.microsoft.com/en-us/library/aa363180.aspx
Can you determine the sign of the polar form of a complex number?   (116 Views)
To compute the absolute value of a negative base raised to a fractional exponent such as: z = (-3)^4.5 you can compute the real and imaginary parts and then convert to the polar form to get the correct value: real_part = ( 3^-4.5 ) * cos( -4.5 * pi ) imag_part = ( 3^-4.5 ) * sin( -4.5 * pi ) |z| = sqrt( real_part^2 + imag_part^2 ) Is there any way to determine the correct sign of z, or perform this calculation in another way that allows you to get the correct value of z expressed without imaginary parts For example, I can compute: z1 = (-3)^-4 = 0,012345679 and z3 = (-3)^-5 = -0,004115226 and I can get what the correct absolute value of z2 should be by computing the real and imaginary parts: |z2| = (-3)^-4.5 = sqrt( 3,92967E-18^2 + -0,007127781^2 ) = 0,007127781 but I need to know the sign.
Memory leak issue with complex data structure   (94 Views)
, I've got a complex data structure (graph-like). Each of my nodes may reference zero or more other nodes, internally managed by a set() object. I have a root node which is not referenced by any other node. So, I created a "clear()" method which is called on all children (by calling their clear() method" and then clears the set with the references of the node itself. I have a serious "leak" issue; even though I clear all those sets and I delete all the references I can have to the current namespace, memory is not freed. I have tried the gc module and it couldn't help (I can't determine where the references are) and I tried using weakref.ref as well to connect object, but then I have problems (objects have no more references to them beside their parents, hence they get deleted). I understand it's impossibile to tell what's my problem without seeing the actual code (which I can't post) but I'm asking if there's any tool/debugger I could employ in order to track what's happening.
Re: ctypes and C99 complex numbers   (96 Views)
Eugen Wintersberger schrieb: > > I want to use ctypes in connection with C functions that use complex > datatypes defined in the C99 standard. Does someone know a simple way > how to implement this Are there any plans to integrate the C99 complex > data types in the ctypes module I have investigated the complex data types a bit and came to the conclusion that libffi (which ctypes is based upon) would have to be extended to support these complex types. I have not looked into the newer libffi sources to find out if this support already has been added, ctypes uses an older version of libffi. By experimenting I found out that on some systems (x86 linux and x86_64 linux) I could 'emulate' the complex type by defining a structure: class Complex(Structure): _fields_ = [("real", c_double), ("imag", c_double)] def _get(self): .... def _set(self, value): .... value = property(_get, _set) but I'm afraid this is not really portable to other platforms. Thomas
[pyserial - winXP] Serial port stop receiving data after a few hours, raise no error   (146 Views)
, My soft passively listen to a device sending +- 300 bytes of data each second. After several hours of work, the soft abruptly stops receiving data without any error, (while the device sends properly, of course) and I need to restart it (the python soft) to "reactivate" the ports. I read that when the serial port encounters an error (frame error or so, I imagine) it stop receiving data until the library function "getCommError()" is called. Am I on the good track Can I call this function from my pyserial code Why pyserial does'nt raise a serial.SerialException in this case Notes: --------- I'm not working with plain serial ports, I use serial over USB (FTDI or so) and serial over Ethernet (moxa.com). I'm in 115k 8N1 and I use 4 ports simultaneously I use python 2.4 with pyserial 2.2 on Windows XP. TIA, Paul Andr
Internals and complexity of types, containers and algorithms   (72 Views)
I am new to python and I miss some understanding of the internals of some types and containers. With my C/C++ background I hope to get some hints to chose the best data structure for my programs. Here are some questions: - Is there a brief description (not source) how the types tuple, string, list and dict are represented internally. Is a list behind the scenes just a double linked list or an array or a mixture of these things Is a dict a tree or a hash array and what is the collision mechanism Is the string an array with some header info - What is the big-O complexity of the most common algorithms for these types and containers Is it O(n), O(n*log(n)) or O(n**2) I mean inserting, appending (front or back), finding something and so on. - The same questions for important and common library containers if you can name some. - Is this information somewhere in the web Why is it not written in the documentation - When I want to use a representation of a game board like chess in C/C++ I use an array[64] or bigger of int or char for the pieces. What data structure or type would be useful in Python when the performance ist most important Is it list or string or an array from a library or what else Harald
Re: Newbie question about sending and receiving data to the commandprompt.   (110 Views)
En Tue, 19 Aug 2008 16:48:26 -0300, aditya shukla escribi: > I am using windows vista and i am trying to send data to the command > prompt > ,this is what is done. > > import subprocess > proc =subprocess.Popen('cmd.exe',stdin=subprocess.PIPE) > proc.communicate('abc') > when i run this the command prompt just blinks and disappears , can > anyone > explain what's going on I don't have a Vista machine to test right now, but I'd expect the above sequence to hang indefinitely. If you want to execute something, don't forget the final \n On XP this works fine: import subprocess proc =subprocess.Popen('cmd.exe',stdin=subprocess.PIPE,stdout=subprocess.PIPE) output = proc.communicate('dir\n')[0] print repr(output) -- Gabriel Genellina
Re: complex representation   (83 Views)
DSM wrote: > From the nothing-is-so-trivial-it's-not-worth-a-usenet-post file: > > Shouldn't the default representation of complex numbers be like that of > floats That is, have a decimal point > > >>> 1 > 1 > >>> 1.0 > 1.0 > >>> 1j > 1j > >>> 1.0j > 1j > >>> 1.0+1.0j > (1+1j) > > > In the relevant bit of floatobject.c, there's a comment explaining that > 1.0 isn't accidental: > > /* Subroutine for float_repr and float_print. > We want float numbers to be recognizable as such, > i.e., they should contain a decimal point or an exponent. > However, %g may print the number as an integer; > in such cases, we append ".0" to the string. */ > > ISTM the same reasoning applies equally to complex numbers. Not necessarily. The reason that having floats always have a decimal point is deable is to ensure roundtripping through eval(repr(x)). The j is sufficient for complexes. There are no complex integers to confuse it with. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
complex representation   (76 Views)
From the nothing-is-so-trivial-it's-not-worth-a-usenet-post file: Shouldn't the default representation of complex numbers be like that of floats That is, have a decimal point >>> 1 1 >>> 1.0 1.0 >>> 1j 1j >>> 1.0j 1j >>> 1.0+1.0j (1+1j) In the relevant bit of floatobject.c, there's a comment explaining that 1.0 isn't accidental: /* Subroutine for float_repr and float_print. We want float numbers to be recognizable as such, i.e., they should contain a decimal point or an exponent. However, %g may print the number as an integer; in such cases, we append ".0" to the string. */ ISTM the same reasoning applies equally to complex numbers. My interest arose because of what I think is a bug in pypy's complex printing: Python 2.4.1 (pypy 1.0.0 build 56124) on linux2 Type "help", "copyright", "credits" or "license" for more information. ``RPython: we use it so you don't have to'' >>>> (1.1+1.1j)**200 (240733537691613523198532543387690598400L+236495565429619338248192Lj) This strangeness comes about because a hack used to recover cpython's behaviour fails at large values. (x.real == floor(x.real), so it decides the value's an integer, and returns the repr of int(x.real).) It's trivial to fix but I think cpython's behaviour is slightly odd here, and the real and imaginary parts of the complex repr should be identical to those of the underlying floats. Or is there some reason I'm missing that things are the way they are
Buffer size when receiving data through a socket?   (95 Views)
"Gabriel Genellina" wrote in message news:mailman.547.1213684963.1044.python-list@python.org... > Both programs say recv(buffer_size) - buffer_size is the maximum number of > bytes to be RECEIVED, that is, READ. recv will return at most buffer_size > bytes. It may return less than that, even if the other side sent the data > in a single operation. > Note that most of the time you want to use the sendall() method, because > send() doesn't guarantee that all the data was actually sent. > I was wondering about sendall(). The examples I've read in two different books are consistent in their use of send() and don't even mention sendall(), so I thought maybe it was for a more specialized situation. > Yes, it is stored in an intermediate buffer until you read it. You typed > "hello" and sent it, the server replied with the string "You typed: > hello"; the OS stores it. You read only 10 bytes "You typed:", the > remaining are still in the buffer. Next round: you type something, the > server replies, you read the remaining bytes from the original reply, and > so on... Oh!!!! I didn't even count "You typed:" as part of the 10 bytes! And what a coincidence that it happens to be exactly 10 characters! That really helped to hide the problem from me! > (Note that in this particular configuration, the client will fill its > buffer at some time: because the server sends at least 11 bytes each > round, but the client reads at most 10 bytes, so the client is always > behind the server...) How is the server sending back 11 bytes Is it because it's sending at least the 10 characters, plus the extra space
Re: Problem with complex numbers   (73 Views)
Matthias Gtz schrieb: > So can you tell me what's the purpose of Complex.py, > > and where can i find the semantic i'am looking for. Well, the file is in the Demo folder. It's just a demo how to implement a naive complex type in Python. Why do you think the power of a complex to a complex is not defined Raising a complex to a complex power is well defined, although the mathematical proof isn't trivial. You have to use the Euler form. Ask Google for some examples Christian
Re: Problem with complex numbers   (71 Views)
Matthias Gtz schrieb: > So if somebody can help me, it would be nice.