onvif代码框架的生成

windows平台下以本地的方式生成onvif代码框架

    • windows平台下以本地的方式生成onvif代码框架
      • 1下载gsoap
      • 2wsdl文件的下载
      • 3下载xsd文件
      • 4生成onvifh文件
      • 5生成代码框架
      • 说在最后

1、下载gsoap

  • 我下载的gsoap版本是2.8的,下载链接

2、wsdl文件的下载

  • 打开官方网站,将下图中所有的wsdl文件保存到本地路径。把下载好的文件打开
    onvif代码框架的生成_第1张图片

修改schemaLocation=”http://xxx/xxx.wsdl”为本地的.wsdl文件路径,以.wsdl文件为例,将url改为本地onvif.xsd的路径,我的所有wsdl文件和xsd文件都放在同一个文件夹下,所以修改路径为schemaLocation=”onvif.xsd”
onvif代码框架的生成_第2张图片

3、下载xsd文件

  • 打开步骤2下载的.wsdl文件,查找对应的schemaLocation=”http://xxx/xxx.xsd”,下载对应的xsd文件,并将schemaLocation=”http://xxx/xxx.xsd”修改成本地.xsd文件所在的文件路径。

我这里已经有一份从官网上保存下来没有修改过的压缩包,这份文档包括所有wsdl文件,以及文件中的.wsdl和.xsd文件。另一个压缩包是我按上面步骤,将所有的.wsdl和.xsd文件进行修改,修改的路径为当前路径下的.wsdl和.xsd。

4、生成onvif.h文件

  • 打开下载好的gsoap文件路径,”\gsoap\bin\win32”,将wsdl文件夹拷贝到当前路径下,我这里为了方便,搜索了gsoap里面的typemap.dat文件,将typemap.dat文件也拷贝到了当路径下,如下图所示
    onvif代码框架的生成_第3张图片
    然后在这个路径下打开cmd窗口(提示:按shift键,单击鼠标右键在此处打开命令窗口),输入以下命令
E:\download\gsoap\gsoap-2.8\gsoap\bin\win32>wsdl2h -t typemap.dat -o onvif.h ./wsdl/accesscontrol.wsdl ./wsdl/accessrules.wsdl ./wsdl/actionengine.wsdl ./wsdl/advancedsecurity.wsdl ./wsdl/analytics.wsdl ./wsdl/analyticsdevice.wsdl ./wsdl/bw-2.wsdl ./wsdl/credential.wsdl ./wsdl/deviceio.wsdl ./wsdl/devicemgmt.wsdl ./wsdl/display.wsdl ./wsdl/doorcontrol.wsdl ./wsdl./event.wsdl ./wsdl/imaging.wsdl ./wsdl/media.wsdl ./wsdl/ptz.wsdl ./wsdl/receiver.wsdl ./wsdl/recording.wsdl ./wsdl/replay.wsdl ./wsdl/rw-2.wsdl ./wsdl/schedule.wsdl ./wsdl/search.wsdl ./wsdl/thermal.wsdl

最后提示,并且在当前路径下生成了一个名为onvif.h的文件

To complete the process, compile with:
> soapcpp2 onvif.h
or to generate C++ proxy and object classes:
> soapcpp2 -j onvif.h

打开生成的onvif.h 在#import 那加入一行代码 #import “wsse.h”用于鉴权

onvif代码框架的生成_第4张图片

5、生成代码框架

  • 在当前打开cmd,输入以下命令
soapcpp2 -j -2 -x onvif.h -I../../import -I../../

最后提示生成成功

**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.14
**  Copyright (C) 2000-2013, Robert van Engelen, Genivia Inc.
**  All Rights Reserved. This product is provided "as is", without any warranty.

**  The soapcpp2 tool is released under one of the following two licenses:
**  GPL or the commercial license by Genivia Inc.

Saving soapStub.h annotated copy of the source input
Saving soapH.h interface declarations
Using ns1 service name: PACSBinding
Using ns1 service style: document
Using ns1 service encoding: literal
Using ns1 service location: http://localhost:80
Using ns1 schema namespace: http://www.onvif.org/ver10/accesscontrol/wsdl
Saving soapPACSBindingProxy.h client proxy class
Saving soapPACSBindingProxy.cpp client proxy class
Saving soapPACSBindingService.h service class
Saving soapPACSBindingService.cpp service class
Saving PACSBinding.nsmap namespace mapping table
Using ns3 service name: AccessRulesBinding
Using ns3 service style: document
Using ns3 service encoding: literal
Using ns3 service location: http://localhost:80
Using ns3 schema namespace: http://www.onvif.org/ver10/accessrules/wsdl
Saving soapAccessRulesBindingProxy.h client proxy class
Saving soapAccessRulesBindingProxy.cpp client proxy class
Saving soapAccessRulesBindingService.h service class
Saving soapAccessRulesBindingService.cpp service class
Saving AccessRulesBinding.nsmap namespace mapping table
Using ns4 service name: ActionEngineBinding
Using ns4 service style: document
Using ns4 service encoding: literal
Using ns4 service location: http://localhost:80
Using ns4 schema namespace: http://www.onvif.org/ver10/actionengine/wsdl
Saving soapActionEngineBindingProxy.h client proxy class
Saving soapActionEngineBindingProxy.cpp client proxy class
Saving soapActionEngineBindingService.h service class
Saving soapActionEngineBindingService.cpp service class
Saving ActionEngineBinding.nsmap namespace mapping table
Using ns5 service name: AdvancedSecurityServiceBinding
Using ns5 service style: document
Using ns5 service encoding: literal
Using ns5 service location: http://localhost:80
Using ns5 schema namespace: http://www.onvif.org/ver10/advancedsecurity/wsdl
Saving soapAdvancedSecurityServiceBindingProxy.h client proxy class
Saving soapAdvancedSecurityServiceBindingProxy.cpp client proxy class
Saving soapAdvancedSecurityServiceBindingService.h service class
Saving soapAdvancedSecurityServiceBindingService.cpp service class
Saving AdvancedSecurityServiceBinding.nsmap namespace mapping table
Using ns6 service name: CredentialBinding
Using ns6 service style: document
Using ns6 service encoding: literal
Using ns6 service location: http://localhost:80
Using ns6 schema namespace: http://www.onvif.org/ver10/credential/wsdl
Saving soapCredentialBindingProxy.h client proxy class
Saving soapCredentialBindingProxy.cpp client proxy class
Saving soapCredentialBindingService.h service class
Saving soapCredentialBindingService.cpp service class
Saving CredentialBinding.nsmap namespace mapping table
Using ns7 service name: DoorControlBinding
Using ns7 service style: document
Using ns7 service encoding: literal
Using ns7 service location: http://localhost:80
Using ns7 schema namespace: http://www.onvif.org/ver10/doorcontrol/wsdl
Saving soapDoorControlBindingProxy.h client proxy class
Saving soapDoorControlBindingProxy.cpp client proxy class
Saving soapDoorControlBindingService.h service class
Saving soapDoorControlBindingService.cpp service class
Saving DoorControlBinding.nsmap namespace mapping table
Using ns8 service name: ScheduleBinding
Using ns8 service style: document
Using ns8 service encoding: literal
Using ns8 service location: http://localhost:80
Using ns8 schema namespace: http://www.onvif.org/ver10/schedule/wsdl
Saving soapScheduleBindingProxy.h client proxy class
Saving soapScheduleBindingProxy.cpp client proxy class
Saving soapScheduleBindingService.h service class
Saving soapScheduleBindingService.cpp service class
Saving ScheduleBinding.nsmap namespace mapping table
Using ns9 service name: ThermalBinding
Using ns9 service style: document
Using ns9 service encoding: literal
Using ns9 service location: http://localhost:80
Using ns9 schema namespace: http://www.onvif.org/ver10/thermal/wsdl
Saving soapThermalBindingProxy.h client proxy class
Saving soapThermalBindingProxy.cpp client proxy class
Saving soapThermalBindingService.h service class
Saving soapThermalBindingService.cpp service class
Saving ThermalBinding.nsmap namespace mapping table
Using tad service name: AnalyticsDeviceBinding
Using tad service style: document
Using tad service encoding: literal
Using tad service location: http://localhost:80
Using tad schema namespace: http://www.onvif.org/ver10/analyticsdevice/wsdl
Saving soapAnalyticsDeviceBindingProxy.h client proxy class
Saving soapAnalyticsDeviceBindingProxy.cpp client proxy class
Saving soapAnalyticsDeviceBindingService.h service class
Saving soapAnalyticsDeviceBindingService.cpp service class
Saving AnalyticsDeviceBinding.nsmap namespace mapping table
Using tan service name: RuleEngineBinding
Using tan service style: document
Using tan service encoding: literal
Using tan service location: http://localhost:80
Using tan schema namespace: http://www.onvif.org/ver20/analytics/wsdl
Saving soapRuleEngineBindingProxy.h client proxy class
Saving soapRuleEngineBindingProxy.cpp client proxy class
Saving soapRuleEngineBindingService.h service class
Saving soapRuleEngineBindingService.cpp service class
Saving RuleEngineBinding.nsmap namespace mapping table
Using tds service name: DeviceBinding
Using tds service style: document
Using tds service encoding: literal
Using tds service location: http://localhost:80
Using tds schema namespace: http://www.onvif.org/ver10/device/wsdl
Saving soapDeviceBindingProxy.h client proxy class
Saving soapDeviceBindingProxy.cpp client proxy class
Saving soapDeviceBindingService.h service class
Saving soapDeviceBindingService.cpp service class
Saving DeviceBinding.nsmap namespace mapping table
Using tev service name: PullPointSubscriptionBinding
Using tev service style: document
Using tev service encoding: literal
Using tev service location: http://localhost:80
Using tev schema namespace: http://www.onvif.org/ver10/events/wsdl
Saving soapPullPointSubscriptionBindingProxy.h client proxy class
Saving soapPullPointSubscriptionBindingProxy.cpp client proxy class
Saving soapPullPointSubscriptionBindingService.h service class
Saving soapPullPointSubscriptionBindingService.cpp service class
Saving PullPointSubscriptionBinding.nsmap namespace mapping table
Using timg service name: ImagingBinding
Using timg service style: document
Using timg service encoding: literal
Using timg service location: http://localhost:80
Using timg schema namespace: http://www.onvif.org/ver20/imaging/wsdl
Saving soapImagingBindingProxy.h client proxy class
Saving soapImagingBindingProxy.cpp client proxy class
Saving soapImagingBindingService.h service class
Saving soapImagingBindingService.cpp service class
Saving ImagingBinding.nsmap namespace mapping table
Using tls service name: DisplayBinding
Using tls service style: document
Using tls service encoding: literal
Using tls service location: http://localhost:80
Using tls schema namespace: http://www.onvif.org/ver10/display/wsdl
Saving soapDisplayBindingProxy.h client proxy class
Saving soapDisplayBindingProxy.cpp client proxy class
Saving soapDisplayBindingService.h service class
Saving soapDisplayBindingService.cpp service class
Saving DisplayBinding.nsmap namespace mapping table
Using tmd service name: DeviceIOBinding
Using tmd service style: document
Using tmd service encoding: literal
Using tmd service location: http://localhost:80
Using tmd schema namespace: http://www.onvif.org/ver10/deviceIO/wsdl
Saving soapDeviceIOBindingProxy.h client proxy class
Saving soapDeviceIOBindingProxy.cpp client proxy class
Saving soapDeviceIOBindingService.h service class
Saving soapDeviceIOBindingService.cpp service class
Saving DeviceIOBinding.nsmap namespace mapping table
Using tptz service name: PTZBinding
Using tptz service style: document
Using tptz service encoding: literal
Using tptz service location: http://localhost:80
Using tptz schema namespace: http://www.onvif.org/ver20/ptz/wsdl
Saving soapPTZBindingProxy.h client proxy class
Saving soapPTZBindingProxy.cpp client proxy class
Saving soapPTZBindingService.h service class
Saving soapPTZBindingService.cpp service class
Saving PTZBinding.nsmap namespace mapping table
Using trc service name: RecordingBinding
Using trc service style: document
Using trc service encoding: literal
Using trc service location: http://localhost:80
Using trc schema namespace: http://www.onvif.org/ver10/recording/wsdl
Saving soapRecordingBindingProxy.h client proxy class
Saving soapRecordingBindingProxy.cpp client proxy class
Saving soapRecordingBindingService.h service class
Saving soapRecordingBindingService.cpp service class
Saving RecordingBinding.nsmap namespace mapping table
Using trp service name: ReplayBinding
Using trp service style: document
Using trp service encoding: literal
Using trp service location: http://localhost:80
Using trp schema namespace: http://www.onvif.org/ver10/replay/wsdl
Saving soapReplayBindingProxy.h client proxy class
Saving soapReplayBindingProxy.cpp client proxy class
Saving soapReplayBindingService.h service class
Saving soapReplayBindingService.cpp service class
Saving ReplayBinding.nsmap namespace mapping table
Using trt service name: MediaBinding
Using trt service style: document
Using trt service encoding: literal
Using trt service location: http://localhost:80
Using trt schema namespace: http://www.onvif.org/ver10/media/wsdl
Saving soapMediaBindingProxy.h client proxy class
Saving soapMediaBindingProxy.cpp client proxy class
Saving soapMediaBindingService.h service class
Saving soapMediaBindingService.cpp service class
Saving MediaBinding.nsmap namespace mapping table
Using trv service name: ReceiverBinding
Using trv service style: document
Using trv service encoding: literal
Using trv service location: http://localhost:80
Using trv schema namespace: http://www.onvif.org/ver10/receiver/wsdl
Saving soapReceiverBindingProxy.h client proxy class
Saving soapReceiverBindingProxy.cpp client proxy class
Saving soapReceiverBindingService.h service class
Saving soapReceiverBindingService.cpp service class
Saving ReceiverBinding.nsmap namespace mapping table
Using tse service name: SearchBinding
Using tse service style: document
Using tse service encoding: literal
Using tse service location: http://localhost:80
Using tse schema namespace: http://www.onvif.org/ver10/search/wsdl
Saving soapSearchBindingProxy.h client proxy class
Saving soapSearchBindingProxy.cpp client proxy class
Saving soapSearchBindingService.h service class
Saving soapSearchBindingService.cpp service class
Saving SearchBinding.nsmap namespace mapping table
Saving soapC.cpp serializers

Compilation successful

说在最后

这个onvif框架是还有进行封装的,我是用别人生成的onvif框架封装后的,基础上进行开发的。这个是封装后的框架,它能够在linux上生成动态库,进行进一步的开发。

你可能感兴趣的:(onvif)