WSSE Headers in Net::HTTP

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 (Parked at Loopia). 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
error:

Unable to parse WSSE header: expected string or buffer

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!

Thanks,
Michael B.

An update on the issue - @connection.post 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”,
PasswordDigest="4/RlcNgcZyF0y/jDyEUxjSYCcJk=
", Nonce=“38c7c9d3ef02d856d208d9da0fcf701b”,
Created=“2007-08-03T03:38:27Z”

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
error.”

My head is soon to explode, that’s for sure.