There was a change made in WSE 2.0. Now you would have to go about it
Thanks. Let me know if this helps or not.
"Alex Shirshov" <nomail@mail.ru> wrote in message
news:%23dDAOMHhEHA.1276@TK2MSFTNGP09.phx.gbl...
> Hello, All!
>
> I have a problem with signing the part of the soap body via wse 2.0. Here
is
> the code
> [code]
> Sub Main()
> Dim g As New localhost.gWse()
>
> Dim reqCtx As SoapContext = g.RequestSoapContext
> Dim tok As New Tokens.UsernameToken(Environment.UserDomainName &
"\"
> & Environment.UserName, _
> "bla-bla-bla", Tokens.PasswordOption.SendHashed)
> reqCtx.Security.Tokens.Add(tok)
>
> Dim guid As Guid = guid.NewGuid()
> Dim d As New localhost.Dummy
> d.Id = "Id:" & guid.ToString
> d._a = 180
>
> Dim sg As New MessageSignature(tok)
> 'sg.SignatureOptions = SignatureOptions.IncludeNone
> sg.SignedInfo.AddReference(New SignatureReference("#" & d.Id))
>
> reqCtx.Security.Elements.Add(sg)
>
> g.SignedMessage(d)
> Console.ReadLine()
> End Sub
> [/code]
>
> This is a Dummy class
> [code]
> '<remarks/>
>
> <System.Xml.Serialization.XmlTypeAttribute([Namespace]:="some-namespace")>
> _
> Public Class Dummy
>
> '<remarks/>
> Public _a As Integer
>
> '<remarks/>
>
>
<System.Xml.Serialization.XmlAttributeAttribute([Namespace]:="
http://docs.oa > sis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xs" & _
> "d")> _
> Public Id As String
> End Class
> [/code]
>
> Whan I call SignedMessage method it throws an exception:
> [exception]
> An unhandled exception of type
> 'System.Security.Cryptography.CryptographicException' occurred in
> microsoft.web.services2.dll
>
> Additional information: Transform chain is empty
> [/exception]
>
> This is client side exception - server side does not receive soap
envelope.
> Without signing (in other words without adding MessageSignature to the
> security elements) or with signing entire soap body I have no problems -
all
> ok.
>
> What am i doing wrong.
>
> With best regards, Alex Shirshov.
>
>