7.1.5 XSD类型编码

    许多SOAP服务需要直接使用XML Schema的类型。gSOAP工具采用的默认编码方式是SOAP RPC编码,这种编码只需要能在多种情况下使用。尽管如此,使用XSD类型的消息还是需要提高互操作性。XSD类型在进行typedef后包含在头文件中,用作gSOAP soapcpp2工具的输入。经过typedef后的类型名保持与XML Schema类型(XSD 类型)一致。例如,以下的typedef声明定义了C/C++内置类型对应的XSD类型:

//Contents of header file

...

typedef char *xsd string; // encode xsd string value as the xsd:string schema type
typedef char *xsd anyURI; // encode xsd anyURI value as the xsd:anyURI schema type
typedef float xsd float;  // encode xsd float value as the xsd:float schema type
typedef long xsd int;     // encode xsd int value as the xsd:int schema type
typedef bool xsd boolean; // encode xsd boolean value as the xsd:boolean schema type
typedef unsigned long long xsd positiveInteger; // encode xsd positiveInteger value as the

                                                // xsd:positiveInteger schema type

...

这种简单的机制使得gSOAP soapcpp2工具在进行序列化和反序列化时可以直接对C++类型和XSD类型进行转换。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值