Call instance method inside WSCLIENTE, to set signature method?‽‽

Primary tabs

Hello,

I would like to change signature's algorithm to be sha1.

I share the current code:

 

(BINARY SECURITY TOKEN and USERNAME TOKEN CODE omitted)

//SIGNATURE TOKEN
    set signSha1=##class(%XML.Security.Signature).%New()
    do signSha1.SetSignatureMethod($$$SOAPWSrsasha1)
    //..SetSignatureMethod($$$SOAPWSrsasha1)
    //$method(signSha1,"SetSignatureMethod",$$$SOAPWSrsasha1)
    //signSha1.SetSignatureMethod($$$SOAPWSrsasha1)
   set sig=signSha1.CreateX509(cert)

I have tried to use SetSignatureMethod, however in the Message Viewer we see:

 

As you see I have tried every other way I could think.

I have read:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cl...

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=GO...

 

How could we change signature algortihm?
 

Replies

You should initialize the Signature object not with %New method, but with Create or Create509 method.

set sig=##class(%XML.Security.Signature).CreateX509(cert)

do sig.SetSignatureMethod($$$SOAPWSrsasha1)