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

Discussion in 'Python' started by Etienne Antoniutti Di Muro, Mar 2, 2004.

  1. 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
    Etienne Antoniutti Di Muro, Mar 2, 2004
    #1
    1. Advertising

  2. > 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
    Diez B. Roggisch, Mar 2, 2004
    #2
    1. Advertising

  3. Etienne Antoniutti Di Muro

    Ype Kingma Guest

    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
    Ype Kingma, Mar 2, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul Emory Sullivan
    Replies:
    1
    Views:
    312
    Paul Emory Sullivan
    Oct 17, 2003
  2. Ja Bo
    Replies:
    7
    Views:
    203
    Kenosis
    Dec 27, 2006
  3. Jason Lillywhite
    Replies:
    6
    Views:
    176
    Jason Lillywhite
    Jun 11, 2008
  4. Prateek Agarwal
    Replies:
    4
    Views:
    402
    Ken Bloom
    Jul 31, 2009
  5. Dave Slayton
    Replies:
    1
    Views:
    186
    Ben Morrow
    Mar 11, 2007
Loading...

Share This Page