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

  • Thread starter Etienne Antoniutti Di Muro
  • Start date
E

Etienne Antoniutti Di Muro

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
 
D

Diez B. Roggisch

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.....
 
Y

Ype Kingma

Etienne said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top