gSoap: How to add info to SOAP Header using gSOAP

本文纠正了gSOAP官方文档中关于SOAP头处理的部分误导信息,并指导如何正确实现客户端通过SOAP头传递用户名和密码进行身份验证。主要步骤包括编辑soapStub.h文件中的SOAP_ENV__Header结构体,添加用户名和密码字段;修改soapC.cpp文件中soap_out_SOAP_ENV__Header函数以序列化这些信息到SOAP头;在.nsmap文件中添加命名空间映射;以及在调用Web服务方法前设置SOAP头。
摘要由CSDN通过智能技术生成
There's some misleading info in gSOAP's official documents in SOAP Header Processing Part. 
This article leads you to the right way and can make your program work.
The use case is: 
Client needs to pass user name and password to Server Side to get authenticated.
The username and password info should be embeded in SOAP Header.
Steps:
1. Edit struct SOAP_ENV__Header in soapStub.h file which is generated by gSOAP's soapcpp2 compiler
Add the neccesary info to this struct 
For example:
The original one is:
struct SOAP_ENV__Header
{
public:
 void *dummy; /* transient */
};
This should be changed to:
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值