473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

read(): 1st argument can't be coerced to byte[]

Hi there everybody,
I want to build a WEB Service client for a test Web Service of mine.
I am using jython.
The code is as follow:

(...)
1 response = request.POST() # posts SOAP to the web service and waits for
2 # response
3 instr = response.getInputStream()
4 reader = Sax2.Reader()
5 doc = reader.fromStream(instr)
(...)

Well, at line 5, I get the error:

read(): 1st argument can't be coerced to byte[]

Does not seem to be a DOM parsing problem.

Any tip about this ?
Thanks in advance
Etienne

Jul 18 '05 #1
2 3672
> 1 response = request.POST() # posts SOAP to the web service and waits for
2 # response
3 instr = response.getInputStream()
4 reader = Sax2.Reader()
5 doc = reader.fromStream(instr)
(...)

Well, at line 5, I get the error:

read(): 1st argument can't be coerced to byte[]
What is that Sax2 thingy? It looks to me that the fromStream-method passes
the instr to something that expects a byte-array - so you could try to read
all the stuff from instr into an array and pass that.
Does not seem to be a DOM parsing problem.


how could it, its SAX.....

--
Regards,

Diez B. Roggisch
Jul 18 '05 #2
Etienne Antoniutti Di Muro wrote:
Hi there everybody,
I want to build a WEB Service client for a test Web Service of mine.
I am using jython.
The code is as follow:

(...)
1 response = request.POST() # posts SOAP to the web service and waits for
2 # response
3 instr = response.getInputStream()
4 reader = Sax2.Reader()
5 doc = reader.fromStream(instr)
(...)

Well, at line 5, I get the error:

read(): 1st argument can't be coerced to byte[]


It seems that the instr argument to reader.fromStream(instr)
needs to be coerced to a java byte array.
You can do that by using the jarray module:
http://www.jython.org/docs/jarray.html

However, that probably conflicts with line 3.
Could you post how to do the same thing in java?

Regards,
Ype

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Gavin | last post by:
Hi, I'm a newbie to programming of any kind. I have posted this to other groups in a hope to get a response from anyone. Can any one tell me how to make my VB program read the Bios serial number...
1
by: Newgene | last post by:
Hi, group, I am trying to dynamically add a method to class by following this post: ...
0
by: Koji Ishii | last post by:
According to the doc, Stream.Read() returns: - # of bytes read, or - 0 for EOF But could that be a negative value? If so, how should we program against such case? I have a loop like this:...
19
by: Mark Richards | last post by:
I've been programming for many years, but have only recently taken a deep "C" dive (bad pun, i know) and need a lot of explanation from an expert. My questions center around those mysterious...
5
by: Pete | last post by:
I having a problem reading all characters from a file. What I'm trying to do is open a file with "for now" a 32bit hex value 0x8FB4902F which I want to && with a mask 0xFF000000 then >> right...
8
by: Patrik Malmström | last post by:
How do I read, write a file binary? I want to open, say, file.exe read it in to the program, then write it out to file2.exe. Like file copy, anyone have a code sample?
3
by: mblatch | last post by:
This is probably a C#-101 type question, but I've struck out on finding an answer. I am setting up a class with a few overloaded constructors. Inside those constructors, I would like to call the...
15
by: waltbrad | last post by:
Hello. I'm studying the book "C++ Primer Plus" by Stephan Prata. In chapter 6 he gives an exercise that reads from a file. The list is thus: 4 Sam Stone 2000 Freida Flass 100500 Tammy...
18
by: wquatan | last post by:
Does someone know an (fast) example of reading files in VBA, Byte per Byte ? I need to be able to take action on every single byte Thx
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.