Forum: Ruby WSSE Headers in Net::HTTP

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
2d66c63b4d8193d0279bd18200e109d3?d=identicon&s=25 Michael Boutros (michaelboutros)
on 2007-08-02 20:49
Hello all! I am creating an API library for Pownce in Ruby. It's hard
because there is no documentation whatsoever, only the hard work done by
those working on Python and ColdFusion versions. It is a pretty long
file, so I've put it up on pastie ( The
server check and
login are working great and I'm sucessfully getting a token etc., but my
problem comes starting with view_notes. The API must create a WSSE token
to be sent along under the name 'auth'. I am creating my WSSE header in
generate_wsse, and from all I can see it looks right. But, instead of my
response's body being the notes, it's the following error with a 401

[code=]Unable to parse WSSE header: expected string or buffer[/code]
Now, I don't know if this means that it's unable to parse the header
because it didn't get sent, or it's invalid, or whatever else there may
be. And so I appeal to you Ruby-ists, hoping that someone else has had
this issue!

Michael Boutros
2d66c63b4d8193d0279bd18200e109d3?d=identicon&s=25 Michael Boutros (michaelboutros)
on 2007-08-03 10:52
An update on the issue - takes three paramaters, with
the second being data, and the third (optional) being headers, which
explains this issue, at least for now. The current issue is that I now
get an EOF error, which is understandable because the header being sent
looks something like:

UsernameToken Username="michaelboutros",
", Nonce="38c7c9d3ef02d856d208d9da0fcf701b",

The exact error:

  EOFError: end of file reached

  method sysread  in protocol.rb at line 133
  method rbuf_fill  in protocol.rb at line 133
  method timeout  in timeout.rb at line 56
  method timeout  in timeout.rb at line 76
  method rbuf_fill  in protocol.rb at line 132
  method readuntil  in protocol.rb at line 116
  method readline in protocol.rb at line 126
  method read_status_line in http.rb at line 2017
  method read_new in http.rb at line 2006
  method request  in http.rb at line 1047
  method view_notes in pownce_clean.rb at line 61
  at top level  in pownce_clean.rb at line 69

Wow. As you can see, the PasswordDigest attribute in the WSSE header has
a newline at the end of it. Adding .chomp! to the password digest
eliminates the EOF error, but then I'm back to my "unable to parse

My head is soon to explode, that's for sure.
This topic is locked and can not be replied to.