If this is truly a web service, you should use the Windows Communication Foundation to create a proxy server and make a call. This greatly facilitates this code.
Honestly, it looks like the package that you use to connect to the web service that you are using (SSO?) Is pretty non-standard and nothing more than the output from HttpWebRequest , which is VERY low level and too complicated to use.
If you are going to protect your own web service (and you are viewing it via an HTTP channel), the easiest way is to obtain a digital certificate for your host, and then use basic HTTP authentication via HTTPS.
You can also use other aspects of the WS-Security specification (for example, message encoding, etc., etc.) to ensure the security of your service.
Please note that WCF supports all of these parameters, so you do not need to make any of these codes out of the box, and you can also place them in IIS.
A good reference for newcomers to the WCF is Michelle Bustamante's "WCF Training: Operations Guide . "
After that, for more advanced WCF content (especially if you want to learn about concepts that revolve around security in WCF and WS- * in general), I highly recommend Juval Lowy's “Programming WCF Services” .
source share