生成的XML文本格式如下:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <soapenv:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema
" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance
" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/
" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
">
-
<soapenv:Header>
<ns1:username xmlns:ns1="Authorization">sysadmin</ns1:username>
<ns2:password xmlns:ns2="Authorization">Amdocsls08</ns2:password>
</soapenv:Header>
- <soapenv:Body>
- <ns1:invoke xmlns:ns1="http://server.webservice.core.epm
" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/
">
<path>epm/cc/assistant/ctiactioninfo/service/CtiActionInfoService</path>
<methodName>saveBatchCtiActionInfo</methodName>
<dataXmlStr><?xml version='1.0'
encoding='UTF-8'?><DBSET><R><C
N="calledWorkNo">agent1</C><C
N="calloutNo">agent1</C><C N="itemSrc">1</C><C
N="itemId">1</C><C N="callId">01</C><C
N="calledExetensionNo">01</C><C
N="aniNo">agent1</C><C N="dnisNo">01</C><C
N="recordId">01</C><C N="orgNo">3401</C><C
N="queueNo">6601</C><C N="flowNo"></C><C
N="workNo">agent</C><C
N="exetensionNo">3001</C></R></DBSET></dataXmlStr>
</ns1:invoke>
</soapenv:Body>
</soapenv:Envelope>
需额外生成的文本为红色标记部位...下面说下如何实现这个Soap Header的添加
在用gsoap工具编译生成的xxx.nsmp文件中加入红色标注代码
一 xxxxxxSoapBinding.nsmap
#include "soapH.h"
SOAP_NMAC struct Namespace namespaces[] =
{
{"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/*/soap-envelope", NULL},
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/*/soap-encoding", NULL},
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL},
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL},
{"ns1", "Authorization", NULL, NULL},
{"ns2", "Authorization", NULL, NULL},
{NULL, NULL, NULL, NULL}
};
二
在 soapC.c中对soap_out_SOAP_ENV_Header()原型进行更改,添加红色标注部分代码.
SOAP_FMAC3
int
SOAP_FMAC4 soap_out_SOAP_ENV__Header(
struct
soap *soap,
const
char
*tag,
int
id,
const
struct
SOAP_ENV__Header *a,
const
char
*type)
{
soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type);
/* transient dummy skipped */
soap_out_string(soap, "ns1:username", 1, &(a->username), "");
soap_out_string(soap, "ns2:password", 2, &(a->password), "");
soap_element_end_out(soap, tag);
return
SOAP_OK;
}
三
在 soapStub.h中对结构体SOAP_ENV_Header添加2个成员.分别为char *username, char *password.
#ifndef
SOAP_TYPE_SOAP_ENV__Header
#define
SOAP_TYPE_SOAP_ENV__Header (18)
/* SOAP Header: */
struct
SOAP_ENV__Header
{
void
*dummy;
/* transient */
char *username;
char *password;
};
#endif
相关推荐
cxf soap header cxf soap header cxf soap header cxf soap header
在Web-service 调用SOAP 新增加SOAP的配置信息。用于验证用户信息。
NULL 博文链接:https://iamliming.iteye.com/blog/1399257
解决Delphi的SOAP Header问题
通过SOAP header对client 进行验证 此例子包括Web services 以及客户端
基于.NET的 SOAP Header and SOAP Extensions 扩展Webservice服务程序例子。
Axis2 通过soap header进行授权服务 客户端根据是否生产stub客户端代码采用两种形式实现。
采用custom SOAP Header实现的 .NET web service 的权限控制源码例子。
4.2 SOAP Header 4.2.1 Use of Header Attributes 4.2.2 SOAP actor Attribute 4.2.3 SOAP mustUnderstand Attribute 4.3 SOAP Body 4.3.1 Relationship between SOAP Header and Body 4.4 SOAP Fault 4.4.1 ...
NULL 博文链接:https://abingpow.iteye.com/blog/2002196
Header Parameter 38 Attachments 39 Representations 42 Response Message Views 42 ♦ XML 42 ♦ JSON 42 ♦ HTML 43 ♦ Raw 44 Creating a TestSuite 44 Create a TestSuit, TestCase & ...
amadeus-ws-client:Amadeus GDS ... 会话管理-为Soap Header 2和Soap Header 4设置正确的SOAP标头。 支持Soap Header 4的所有功能,例如有状态和无状态消息。 根据提供的选项构建正确的请求消息:库试图在可能的情况
对web services的消息,只解析soap消息头,不解析消息体。
安全性WsSecurity将WSSE身份验证标头添加到您的SOAP请求中如何使用它该存储库包含可以单独使用的多个类,但现在仅使用WsSecurity类更容易/更好。 WsSecurity类提供了一个静态方法,该方法采用的参数应足以创建SOAP...
PHP使用SOAP调用WEBSERVICE接口
client端的culture通过SOAP header传到service端,然后通过自定义的CallContextInitializer设置当前方法执行的线程culture。在client端,当前culture信息是通过OperationContext.Current.OutgoingMessageHeaders手工...
gosap用户使用手册 gSOAP 2.7.8 User Guide ...12 SOAP Header Processing 13 MIME Attachments 14 DIME Attachments 15 MTOM Attachments 16 XML Validation 17 SOAP-over-UDP 18 Advanced Features
主要介绍了Asp.net页面中调用soapheader进行验证的操作步骤,感兴趣的小伙伴们可以参考一下
SOAP 1.什么是SOAP? 一种基于 XML 的、用于在 Web 上交换结构化和类型信息的简单的轻量协议 SOAP是一个跨平台的标准,用来格式化在WebService和客户端应用程序间传递的消息 ... SOAP Header SOAP Body SOAP Default
一个简单的基于SOAP headers的WebService式身份验证 通过通过SOAP Header身份验证。 通过集成windows身份验证。