You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GSOAP编译C++ ONVIF程序因依赖页面404报错的问题咨询

GSOAP编译C++ ONVIF程序XOP引用404报错处理

问题根因

使用gSOAP库编译C++语言实现的ONVIF程序时出现编译报错,排查确认错误原因是onvif.xsd规范中引用的XOP Include schema地址返回404状态码无法访问,对应引用配置如下:

<xs:import namespace="http://www.w3.org/2004/08/xop/include" schemaLocation="http://www.w3.org/2004/08/xop/include"/>

该问题属于上游公共资源失效:W3C官网发布的XOP10规范文档中,同样指向上述已失效的404地址,并非ONVIF规范配置独有错误。

可用修复方案

目前暂无官方发布的统一补丁,可通过本地替换schema的方式直接解决,不影响最终程序功能:

  • 将以下XOP Include标准schema内容保存为本地.xsd文件:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:tns="http://www.w3.org/2004/08/xop/include" 
targetNamespace="http://www.w3.org/2004/08/xop/include">

  <xs:element name="Include" type="tns:Include"/>
  <xs:complexType name="Include">
    <xs:sequence>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="href" type="xs:anyURI" use="required"/>
    <xs:anyAttribute namespace="##other"/>
   </xs:complexType>
</xs:schema>
  • 修改onvif.xsd中对应xs:import节点的schemaLocation属性,将原有网络地址替换为刚才保存的本地schema文件路径,重新执行gSOAP代码生成、编译流程即可正常通过。

注:上述schema内容为XOP标准的固定定义,不存在版本差异,本地替换后不会引发ONVIF功能兼容性问题。

内容的提问来源于stack exchange,提问作者Julien Greard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.03 09:12:29