We're in a strange situation with a legacy winforms VB.NET 1.1 application using ASMX web services. Trying to send a user Token from a WindowsIdentity object as a parameter to a WebMethod. I will be adding a 'HACK: comment.
System.Security.Principal.WindowsIdentity.GetCurrent().Token
The token is of type IntPtr, the first problem is the WSDL being generated doesn't support IntPtr with the error of 'unsupported type'
I'm aware this is a big WTF question and sounds insecure, so any simple helpful alternatives are welcome but there are a lot of constraints on how we can change this system, including complications with the hosting environment. So I would just like to get our piece of data over to the web service to save a lot of other headaches.
Problem 1
Error from WSDL Generation:
Method userClass.TestSendIntPtr can not be reflected.
--> There was an error reflecting 'token'.
--> System.IntPtr is an unsupported type.
An alternate approach (extending the WTF factor) - trying to get around the IntPtr issue is to just put the IntPtr into a System.IO.Stream using
BinaryFormatter.Serialize()
on the winforms app end and BF.Deserialize() on the service. But this leads to a new strange issue.
Defining the Web Service Method's signature in this fashion:
Public Class UserService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function UserToken(ByVal tokenStream As System.IO.Stream) As Boolean
The new strange issue arises on the client end as a compilation error, as if the 'System.IO' qualification of Stream is being ignored, and being interpreted as part of the UserService class...
Problem 2
Value of type 'System.IO.Stream' cannot be converted to 'USERSERVICE.Stream'.
So an answer to either question, or similar alternate approach would be great...