xml/ perl/ soap/ wss

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.

Related Question How can I import schemas required by a WSDL when using XML::Compile::WSDL11? How to add an arbitrary field with XML::Compile::WSDL11 (mistake: tag `param' not used at…) Perl WSDL11 Can't Make it to Work on WSDL with XML import Perl WSDL11 Can't Make it to Work on two WSDL files WSSE with XML::Compile::SOAP::WSS and Perl PHP Array/Object Structure for SOAP (WSDL/wsse) Adding Namespace to header in XML How to pass authentication header for WSDL XML with PHP soap? Soapclient isn't resolving WSDL (with SSL certificate and wsse) Modify existing XML, adding and deleting nodes java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM