gSOAP HTTP身份验证
gSOAP HTTP Authentication
我正在使用gSOAP 2.8.15,并试图按照gSOAP文档第19.14节中的说明实现HTTP身份验证(http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sec9.14).
唯一的区别是文档中引入的代码是用C编写的,但我是用C++编写的。
这是我的代码客户端的网络服务
// The variable wsp is a instance of web service proxy generated by soapcpp2.
// The proxy is a sub-class of the class soap
wsp.userid = "user";
wsp.passwd = "password";
// call the function of web service
wsp.get_version(&result);
在服务器端,我使用这些代码来检查身份验证:
// The variable wss is the a instance of web service service generated by soapcpp2.
if (wss.userid == NULL || wss.passwd == NULL)
//......
问题是,当我使用客户端代码调用web服务的函数时,服务器端的userid和passwd总是为NULL。但是,当我使用soapUI通过以抢先授权模式传递userid和passwd来调用相同的函数时,服务器将毫无问题地获得信息。
如果有人能帮我解决这个问题,我将不胜感激。感谢您的关注。
我用tcpdump捕获了在web服务服务器和客户端之间发送的包,发现当客户端调用web服务的函数时,没有发送http头。因此,我在gSOAP的文档中进行了一些搜索,发现了以下句子:
客户端可以使用http://前缀。不存在时,没有HTTP标头发送,并且不会向服务
它解决了我的问题。。。
相关文章:
- LibGit2 SSH身份验证失败
- 为什么 WinInet 在通过 FQDN 连接时无法通过协商自动进行身份验证,但如果通过 IP 连接则成功?
- 如何通过NetHTTPClient在HTTPS中进行身份验证
- 处理身份验证弹出窗口在wxWebView
- 如何测试我的谷歌身份验证器实现?
- 通过 Boost 和 C++ 进行 SMTP 身份验证
- libtorrent是否支持带摘要身份验证的http web种子
- 将Windows身份验证与cpprestsdk一起使用
- OCCI:使用SSL钱包身份验证连接到OracleDB
- 为什么我不能使用外围设备进行身份验证
- 无法使用C++代码向MongoDB进行身份验证
- 模拟的 HTTP 身份验证仅在本地主机上工作
- 使用OpenSSL的SHA 512 HMAC消息身份验证的问题
- Windows 套接字和身份验证构建在包含 Poco-Library 时失败
- 解析 HTTP 的摘要式身份验证的正确正则表达式模式是什么?
- Casablanca中的HTTP身份验证
- 如何使用POCO使用HTTP基本身份验证做HTTP帖子
- 可以创建一个单例 c++ 来进行身份验证并使用对 Facebook API 的 HTTP 请求在墙上发布
- gSOAP HTTP身份验证
- 如何发送具有基本身份验证的HTTP请求