Hi
I have been using the UsernameSigningCode console sample supplied with WSE
2.0 SP2 and managed to get it working with ease. Based on the code from
console sample, I created a similar windows forms client and got that
working easily too. My problem is when I call web methods asynchronously,
ie, instead of calling serviceProxy.StockQuoteRequest(symbols) I call
serviceProxy.BeginStockQuoteRequest(symbols, new
AsyncCallback(StockQuoteCallback), null); and in my callback method I
display the results in a multiline text box on the form. Mostly, everthing
is fine and works as expected, but every now and then I get the following
error :
System.Security.Cryptography.CryptographicException: WSE502: The target
element referenced by the following id can not be found in the message:
Id-8fe25618-0141-4b4a-b767-bdc26ea70a30. Make sure that the element is
present at the time when the signing or encryption operation is performed.
at System.Web.Services.Protocols.WebClientAsyncResult.WaitForResponse()
at System.Web.Services.Protocols.WebClientProtocol.EndSend(IAsyncResult
asyncResult, Object& internalAsyncState, Stream& responseStream)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.EndInvoke(IAsyncResult
asyncResult)
at
UsernameSignCodeFormsClient.StockServiceWse.EndStockQuoteRequest(IAsyncResult
asyncResult) in C:\Program Files\Microsoft
WSE\v2.0\Samples\CS\QuickStart\UsernameSigning\Code\UsernameSignCodeFormsClient\UsernameSigningProxy.cs:line
63
at UsernameSignCodeFormsClient.Form1.StockQuoteCallback(IAsyncResult
result) in c:\program files\microsoft
wse\v2.0\samples\cs\quickstart\usernamesigning\code\usernamesigncodeformsclient\form1.cs:line
140
Like I say, normally everything runs ok and I just get the error every now
and then. I wanted to investigate further, so I made a modification to my
test form so that it makes a series of 10 calls to to the
BeginStockQuoteRequest in a loop with a 1 second delay between each call and
now I get the error more or less everytime but at random points within the
loop, ie the error might occur on the 5th callback, or 7th callback etc.
I hope someone can help as I don't even know where to begin to look to sort
it out!
Thanks
John