I'm using the XML::Compile
suite to work with a SOAP API
that uses WSSE
security with a digest password generated with sha1
. Unfortunately the password digest protocol that XML::Compile::WSS::BasicAuth
uses is
sha1_base64(encode utf8 => "$nonce$created$password").'='
where $nonce
and $password
are text values and $created
is a timestamp, while the API
I'm working with uses the digest generator
sha1_base64($nonce.$created.sha1($password)).'='
I figured I could fix this by rewritinng the password using a hook, as in
$wsdl->addHook(type=> 'wsse::PasswordString',replace => \\&replace_pwd);
Since the curent CPAN
documentation does not clearly specify hook call syntax, I relied on the module author's comments at http://grokbase.com/t/sc/xml-compile/1283vscwxz/need-help-with-xml-compile-translate-writer-and-attributes-with-namespace
. However the callback function replace_pwd()
is never called with the result that the original (wrong) password generated by XML::Compile::WSS::BasicAuth
continues to get sent.
How do I get this to work?
TIA.
I had the exact same problem recently and ended up creating an instance of XML::Compile::WSS::BasicAuth, setting XCWB_login with the code copied from XML::Compile::WSS::BasicAuth->prepareWriting modified to generate the password string as I needed, and passing that BasicAuth instance as the wsse_Security option to XML::Compile::Schema->call.
This is super lame, but the only way that I found to solve this problem using these libraries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.