如何在Windows应用程序中验证Web服务 [英] how to authenticate Web Service in windows application

查看:79
本文介绍了如何在Windows应用程序中验证Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过soap标头传递Web服务的身份验证参数。我试过下面的代码



I want to pass authentication parameter of web service by soap header. I have tried below code

AuthWebService.WebService webService = new AuthWebService.WebService();
    AuthWebService.AuthHeader authentication = new 
                              AuthWebService.AuthHeader();

    authentication.Username = "test";
    authentication.Password = "test";
    webService.AuthHeaderValue = authentication;





在上面的代码中我没有得到 webService.AuthHeaderValue 我尝试时的属性。



此代码在Windows应用程序中不起作用。它正在运行Web应用程序。在Web应用程序中,它为我提供了添加Web引用的选项,但它只提供了添加引用选项的Windows应用程序。有人对此有所了解吗?如何在Windows应用程序中使用它?



请提供一些解决方案。



In above code i did not get webService.AuthHeaderValue property when i try.

this code does not work in windows application. it is working web application. In web application it gives me option to add web reference but windows application it gives only add reference option. Anyone have idea about this? how to use it in windows application??

please provide some solution.

推荐答案

参考此完整aricle

Web服务身份验证(使用SOAP)标题) [ ^ ]

[更新]

请参阅这些链接以获取帮助

http://intellitect.com/calling-web-services-using-basic-authentication/ [< a href =http://intellitect.com/calling-web-services-using-basic-authentication/target =_ blanktitle =New Window> ^ ]

HTTP:// stackov erflow.com/questions/897782/how-to-add-custom-http-header-for-c-sharp-web-service-client-consuming-axis-1-4 [ ^ ]
Refer this complete aricle
Authentication for Web Services (using SOAP headers)[^]
[Updated]
Refer these links for help
http://intellitect.com/calling-web-services-using-basic-authentication/[^]
http://stackoverflow.com/questions/897782/how-to-add-custom-http-header-for-c-sharp-web-service-client-consuming-axis-1-4[^]


这篇关于如何在Windows应用程序中验证Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆