From: Jeff Hopper on
You could use this general procedure on your client before calling a given
web service method:

1) Create a NetworkCredential with the entered username/password; call it
nc, for example.
2) Create an instance of your web service proxy class; call it ws, for
example.
3) Set ws.Credentials = nc and ws.PreAuthenticate = true.
4) Override your web service proxy class's GetWebRequest method and inside
the method add the credentials to the request header. See
http://mark.michaelis.net/Blog/CallingWebServicesUsingBasicAuthentication.aspx
for a good example.

Hope this helps!

Jeff Hopper
Hopper Consulting, Inc.

"Nina" <Nina(a)discussions.microsoft.com> wrote in message
news:7F60B567-16A2-4480-92FC-992D998D67EC(a)microsoft.com...
> Compact Framework 2.0 does not include support for WSE 3.0
> (Web.Services3).
> What can I use instead of SoapContext to pass my credentials?
> On Windows application I use C# code:
>
> NewToken.com.digitalpaytech.sandbox.TransactionInfoServiceWse
> myPayStationWse = new
> NewToken.com.digitalpaytech.sandbox.TransactionInfoServiceWse();
>
> SoapContext myContext = myPayStationWse.RequestSoapContext;
> UsernameToken token = new UsernameToken(myUsername, myPassword,
> PasswordOption.SendPlainText);
> myContext.Security.Tokens.Add(token);
> myContext.Security.MustUnderstand = true;
>
> It works fine. How can I connect to secure Web Server from Mobile
> application where SoapContext is not available?
>