Sybren Stuvel wrote:
da********@gmai l.com enlightened us with:
I want to send thorugh the API. However, no matter how I try it,
Java on the other end doesn't like what I'm passing it there.
What have you tried and how did it fail?
See below.
How can I mimic a byte array in python?
Strings?
OK, I'll put that attempt up front. Here's a couple of tries:
<test code snippet>
fileobj = open('testfile. txt', mode='r')
chararray = fileobj.read()
fileobj.close()
soap.addAttachm entsToIssue(aut h,'TST-4','testfile.tx t',chararray)
<fails with>
SOAPpy.Types.fa ultType: <Fault soapenv:Server. userException:
org.xml.sax.SAX Exception: Found character data inside an array element
while deserializing: <SOAPpy.Types.s tructType detail at -1216265236>:
{'hostname': '<removed>', 'faultData': <SOAPpy.Types.s tructType
faultData at -1216226708>: {'exception': None, 'message': 'Found
character data inside an array element while deserializing'} }>
<'nother snippet>
fileobj = open('testfile. txt', mode='r')
chararray = array.array('c' )
chararray.fromf ile(fileobj, stat('testfile. txt').st_size)
fileobj.close()
soap.addAttachm entsToIssue(aut h,'TST-4','testfile.tx t',chararray)
<fails with>
SOAPpy.Types.fa ultType: <Fault soapenv:Server. userException:
org.xml.sax.SAX Exception: Found character data inside an array element
while deserializing: <SOAPpy.Types.s tructType detail at -1216482740>:
{'hostname': '<removed>', 'faultData': <SOAPpy.Types.s tructType
faultData at -1216075252>: {'exception': None, 'message': 'Found
character data inside an array element while deserializing'} }>
<'nother snippet>
fileobj = open('testfile. txt', mode='r')
chararray = array.array('c' )
chararray.fromf ile(fileobj, stat('testfile. txt').st_size)
#chararray = fileobj.read()
fileobj.close()
soap.addAttachm entsToIssue(aut h,'TST-4','testfile.tx t',[chararray])
This one "works" in that it runs, but the server on the other end gets
garbage unrelated to the test file.
I've tried a few other other ideas including other modes for the array
(b/B), but those are the highlights.