[gsoap][C] 未定义 SOAP_TYPE_wchar

[gsoap][C] Undefined SOAP_TYPE_wchar

我坚持使用 gsoap 2.7.13(wsdl2h v1.2.1 和 soapcpp2 v2.7.13)。当我尝试在纯 C 项目中将字符串映射到宽字符时,出现许多编译错误 (SOAP_TYPE_wchar 未定义)。

有人试过和我一样的问题吗?

此致,

我的typemap.dat

[
struct SOAP_ENV__Header
{
    _XML wsse__Security;
};
]

#   Use unicode
xsd__string = | wchar_t* | wchar_t*

#   CMIS recommended prefix
SOAP-ENV    =   "http://schemas.xmlsoap.org/soap/envelope"
SOAP-ENC    =   "http://schemas.xmlsoap.org/soap/encoding"
xsi         =   "http://www.w3.org/2001/XMLSchema-instance"
xsd         =   "http://www.w3.org/2001/XMLSchema"
ns1         =   "http://docs.oasis-open.org/ns/cmis/core/200908/"
ns2         =   "http://docs.oasis-open.org/ns/cmis/messaging/200908/"
cmis        =   "http://docs.oasis-open.org/ns/cmis/ws/200908/"
cmis2       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/DiscoveryServicePortBinding"
cmis3       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/MultiFilingServicePortBinding"
cmis4       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/NavigationServicePortBinding"
cmis5       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/ObjectServicePortBinding"
cmis6       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/PolicyServicePortBinding"
cmis7       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/RelationshipServicePortBinding"
cmis8       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/RepositoryServicePortBinding"
cmis9       =   "http://docs.oasis-open.org/ns/cmis/ws/200908/VersioningServicePortBinding"
cmis10      =   "http://docs.oasis-open.org/ns/cmis/ws/200908/ACLServicePortBinding"

# End of file

还有我的命令行:

wsdl2h -c -o cmis_ws.h -t typemap.dat -x "http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/schemas/CMISWS-Service.wsdl"
soapcpp2 -c -p cmis cmis_ws.h

解决这个问题的补丁:

  1. 编辑 gsoap/src/symbol2.c 行 11201 并插入
  if (is_wstring(typ)) /* wchar_t* is serializable but wchar_t is transient */
    return 0;

函数 is_transient 的第一部分应该如下所示:

int
is_transient(Tnode *typ)
{
  if (!typ)
    return 1;
  if (typ->type == Tstruct && typ->id == lookup("soap"))
    return 1;
  if (is_external(typ) || is_volatile(typ))
    return 0;
  if (typ->transient > 0)
    return 1;
  if (is_wstring(typ)) /* wchar_t* is serializable but wchar_t is transient */
    return 0;
  1. 运行 make 再次,您可以在 gsoap/src 目录中执行此操作。这会在 gsoap/src 目录中构建 soapcpp2。将 soapcpp2 复制到您的项目或 $PATH.
  2. 上的 bin 目录