天天看點

Ubuntu下安裝gsoap

昨天在ubuntu下進行安裝gSOAP,費了很多時間,沒成功,今天又來找了大量教程資料,終于一次成功,這裡寫下自己的安裝步驟和方法,供大家參考。

首先下載下傳gsoap,我下載下傳的是gsoap-2.8.1.zip

用unzip gsoap-2.8.1.zip指令解壓縮,會解壓生成gsoap-2.8檔案夾。

cd gsoap-2.8

在安裝之前需要先安裝一些編譯工具。

安裝編譯工具:

  $sudo apt-get install build-essential

  為了成功編譯gSOAP,您需要安裝GTK+的開發檔案和GLib庫(libraries)。

  $sudo apt-get install libgtk2.0-dev libglib2.0-dev

  安裝Checkinstall以便管理您系統中直接由源代碼編譯安裝的軟體。

  $sudo apt-get install checkinstall

       安裝YACC,YACC是Unix/Linux上一個用來生成編譯器的編譯器(編譯器代碼生成器)。

       $sudo apt-get install flex bison

       安裝OpenSSL

       $sudo apt-get install openssl

       安裝OpenSSL通常的庫檔案,首先使用以下指令來确定在Ubuntu系統中可獲得的庫檔案的應用版本:

       $sudo apt-cache search libssl | grep SSL 

       $sudo apt-get install libssl-dev 

簡單安裝:(安裝到/usr/local/gSOAP目錄下)

        configure --prefix=/usr/local/gSOAP

        make

        make install

安裝完成。

為了後面的C和C++版本的服務和用戶端的開發能夠脫離源代碼目錄,最好還要如下處理:

(1)将源代碼目錄下gsoap子目錄中的import目錄拷貝到gSOAP目錄下來;

(2)gSOAP目錄下建一個env目錄,将gsoap/samples/link下的所有檔案拷貝過來,并且生成envC.o(C版本要用到),方法是:

/usr/local/gSOAP/bin/soapcpp2 -penv -c env.h

g++ -c -I /usr/local/gSOAP/include envC.c

(3)gSOAP目錄下建一個src目錄,将将源代碼目錄下gsoap子目錄中的stdsoap*.*拷貝過來。

安裝完成。

安裝uuid

1 apt-get install uuid uuid-dev

      一直以來都是在CSDN上面學習别人的東西,很多次想寫點什麼但是又無從寫起。由于公司項目需要,最近一段時間在研究onvif,在網上找了很多資料,發現資料是非常多,但是很少有比較全的資料,或者資料太多無從下手。我打算從做項目開始,用CSDN部落格記錄我的項目筆記,同時希望能幫助到需要幫助的人,以感謝這麼多年來CSDN上各位高手對我的幫助。onvif的開發從gsoap的移植開始!今天完成了gsoap的移植,生成了代碼。

一、 開發環境

本人開發環境為:

1. 電腦主頻2.6G,記憶體4G;

2. 虛拟機:Product: VMware® Workstation;  Version: 7.1.3 build-324285

3. linux作業系統版本:

[[email protected] ~]# cat /proc/version

Linux version 2.6.25-14.fc9.i686 (mockbuild@) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) ) #1 SMP Thu May 1 06:28:41 EDT 2008

[[email protected] ~]#

4. linux編譯環境:海思交叉編譯器arm-hisiv100nptl-linux-g++

二、必備網址

1. Onvif官網:http://www.onvif.org/

2. gsoap官網:http://www.cs.fsu.edu/~engelen/soap.html

三、操作步驟詳解

1. 下載下傳gsoap

根據以上提供的位址,登陸gsoap官網下載下傳最新的安裝包和相關文檔;截止今天(2013年8月5日),官網釋出的最新版本的gsoap工具為2.8.15版本;最新版本的使用,可以參考文檔:《gSOAP 2.8.15 User Guide .pdf》,該文檔有非常詳細的說明,現在網絡上的大部分的demo都是copy這裡的;該文檔值得研究;該文檔在其官網上可以下載下傳,下載下傳位址為:http://www.cs.fsu.edu/~engelen/soap.html;也可以在官網線上檢視;或者,可以在gsoap安裝包裡面找到該文檔,路徑為:gsoap_2.8.15/gsoap-2.8/gsoap/doc, 名字為soapdoc2.pdf的檔案。

2. 安裝

将下載下傳的安裝包解壓,并拷貝到linux的操作目錄,本人操作目錄為:

$: /home/samba/onvif-2013.08.05/  

以上面的目錄為例:(注意以下操作均在root使用者權限下進行)

首先進入目錄cd /home/samba/onvif-2013.08.05/ gsoap_2.8.15/gsoap-2.8/

然後,配置編譯環境:

指令:$:./configure

然後,編譯連接配接

指令:$:make

最後,安裝gSOAP

指令:$:make install

以上指令執行完成之後可用wsdl2h或者soapcpp2檢視gSOAP是否已經安裝成功;安裝成功即會顯示該指令:如下所示

[[email protected] ~]# wsdl

wsdl    wsdl2   wsdl2h 

[[email protected] ~]#

[[email protected] ~]#

[[email protected] ~]# soap

soapcpp2  soapsuds 

[[email protected] ~]#

如果不知道被安裝在哪個目錄,可以用指令查詢:

指令:$:find / -name wsdl2h

如下所示:

[[email protected] ~]#

[[email protected] ~]# find / -name wsdl2h

/usr/local/bin/wsdl2h

^C

[[email protected] ~]#

[[email protected] ~]#

即安裝的wsdl2h和soapcpp2存在于系統的/usr/local/bin/目錄

至此,完成了gsoap2.8.15工具的安裝工作;

3. 頭檔案生成

以上兩個指令中,指令wsdl2h用于生成頭檔案,指令soapcpp2用于生成源檔案;這兩個指令在/gsoap_2.8.15/gsoap-2.8/gsoap/bin中可以找到。bin目錄下面包含三個目錄,分别表示win32系統,linux系統以及macosx系統下的指令。但是bin目錄下面的是源碼包裡面自帶的,我們在自己系統裡開發的話最好根據自己的編譯器去編譯生成新的指令。編譯生成的新的指令可以在gsoap目錄下看到。

工具安裝完成之後可以在linux下重建立立一個自己的目錄,用來生成代碼:

這裡建立目錄:onvif_new

完整路徑為:/home/samba/onvif-2013.08.05/ onvif_new/

将gsoap 目錄下的typemap.dat檔案拷貝到目錄onvif_new

(1)線上生成頭檔案:

在onvif_new目錄下執行指令:

~onvif_new$: wsdl2h -o onvif.h -c -s -t ./typemap.dat

http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl

http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl

http://www.onvif.org/onvif/ver10/event/wsdl/event.wsdl

http://www.onvif.org/onvif/ver10/display.wsdl

http://www.onvif.org/onvif/ver10/deviceio.wsdl

http://www.onvif.org/onvif/ver20/imaging/wsdl/imaging.wsdl

http://www.onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl

http://www.onvif.org/onvif/ver10/receiver.wsdl

http://www.onvif.org/onvif/ver10/recording.wsdl

http://www.onvif.org/onvif/ver10/search.wsdl

http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl

http://www.onvif.org/onvif/ver10/replay.wsdl

http://www.onvif.org/onvif/ver20/analytics/wsdl/analytics.wsdl

http://www.onvif.org/onvif/ver10/analyticsdevice.wsdl

http://www.onvif.org/ver10/actionengine.wsdl

http://www.onvif.org/ver10/pacs/accesscontrol.wsdl

http://www.onvif.org/ver10/pacs/doorcontrol.wsdl

每個網址之間用空格分開,執行完指令即可生成頭檔案onvif.h。

以上位址來自onvif官網,可以自己登入官網檢視。

注意,這種方式的話一定要保證您的虛拟機能出外網,簡單說就是在虛拟機下能ping通百度或者其他外網位址;而且要保證網絡比較快,否則在生成過程中會出現下載下傳檔案逾時而導緻生成頭檔案失敗。該方式生成的話,所有檔案均是線上實時下載下傳。

(2)離線生成頭檔案

如果目前電腦無法聯網,則可以通過離線的方式來生成,指令為:

~onvif_new$: wsdl2h -o onvif.h -c -s -t ./typemap.dat devicemgmt.wsdl media.wsdl event.wsdl display.wsdl

deviceio.wsdl imaging.wsdl ptz.wsdl receiver.wsdl recording.wsdl search.wsdl remotediscovery.wsdl

replay.wsdl analytics.wsdl analyticsdevice.wsdl actionengine.wsdl accesscontrol.wsdl doorcontrol.wsdl

注意不同的wsdl以空格分開。

目前Onvif官網提供的最新的WSDL檔案一共有17個,可以将其下載下傳下來。不過這些檔案直接都是互相關聯的,下載下傳的話,除了這17個檔案之外,還要下載下傳所有相關聯的檔案。另外,下載下傳之後,還需要更改檔案中的路徑,将wsdl檔案中的schemaLocation以及location所指的路徑進行修改,修改為本地的位址。将所有需要下載下傳的檔案下載下傳到onvif_new目錄,并修改相關位址。當然如果網速夠快,提倡直接線上生成頭檔案和源檔案。另外為了避免後續開發過程中出現某些功能的預設,最好一次性生成包含所有功能的代碼。

(3)離線生成頭檔案過程:

離線生成頭檔案過程如下所示:

[[email protected] onvif_new]# 

[[email protected] onvif_new]# 

[[email protected] onvif_new]# 

**  The gSOAP WSDL/Schema processor for C and C++, wsdl2h release 2.8.15

**  Copyright (C) 2000-2013 Robert van Engelen, Genivia Inc.

**  All Rights Reserved. This product is provided "as is", without any warranty.

**  The wsdl2h tool is released under one of the following two licenses:

**  GPL or the commercial license by Genivia Inc. Use option -l for details.

Saving onvif.h

Reading type definitions from type map file './typemap.dat'

Reading file 'devicemgmt.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'devicemgmt.wsdl'

Reading file 'media.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'media.wsdl'

Reading file 'event.wsdl'...

Reading file 'bw-2.wsdl'...

Reading file 'rw-2.wsdl'...

Reading schema file 'r-2.xsd'...

Done reading 'r-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Done reading 'rw-2.wsdl'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'bw-2.wsdl'

Done reading 'event.wsdl'

Reading file 'display.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'display.wsdl'

Reading file 'deviceio.wsdl'...

Done reading 'deviceio.wsdl'

Reading file 'imaging.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'imaging.wsdl'

Reading file 'ptz.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'ptz.wsdl'

Reading file 'receiver.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'receiver.wsdl'

Reading file 'recording.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'recording.wsdl'

Reading file 'search.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'search.wsdl'

Reading file 'remotediscovery.wsdl'...

Done reading 'remotediscovery.wsdl'

Reading file 'replay.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'replay.wsdl'

Reading file 'analytics.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'analytics.wsdl'

Reading file 'analyticsdevice.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'analyticsdevice.wsdl'

Reading file 'actionengine.wsdl'...

Reading schema file 'onvif.xsd'...

Done reading 'onvif.xsd'

Reading schema file 'b-2.xsd'...

Done reading 'b-2.xsd'

Reading schema file 'bf-2.xsd'...

Done reading 'bf-2.xsd'

Reading schema file 't-1.xsd'...

Warning: unexpected element 'xsd:unique' at level 2 is skipped (safe to ignore)

Warning: unexpected element 'xsd:unique' at level 6 is skipped (safe to ignore)

Done reading 't-1.xsd'

Done reading 'actionengine.wsdl'

Reading file 'accesscontrol.wsdl'...

Reading schema file 'types.xsd'...

Done reading 'types.xsd'

Done reading 'accesscontrol.wsdl'

Reading file 'doorcontrol.wsdl'...

Reading schema file 'types.xsd'...

Done reading 'types.xsd'

Done reading 'doorcontrol.wsdl'

Warning: 8 service bindings found, but collected as one service (use option -Nname to produce a separate service for each binding)

Warning: 2 service bindings found, but collected as one service (use option -Nname to produce a separate service for each binding)

Warning: 2 service bindings found, but collected as one service (use option -Nname to produce a separate service for each binding)

Warning: WSDL "WS-BaseNotification" has no bindings to implement operations

To complete the process, compile with:

> soapcpp2 onvif.h

[[email protected] onvif_new]# 

[[email protected] onvif_new]# 

指令執行完成之後可以在目前目錄下看到onvif.h。

4. 源檔案的生成

生成onvif.h頭檔案之後,即可根據soapcpp2指令生成C源檔案或者CPP源檔案。

指令為:

onvif_new $: soapcpp2 -c onvif.h -x -I import路徑 -I gsoap路徑

如果要生成cpp檔案,則為:

onvif_new $: soapcpp2 -cpp onvif.h -x -I import路徑 -I gsoap路徑

兩種方式生成的檔案基本相同,隻是名字略有差別,大家可以生成對比看看。

如下所示:

[[email protected] onvif_new]# 

[[email protected] onvif_new]# soapcpp2 -c onvif.h -x -I /home/samba/onvif-2013.08.05/gsoap_2.8.15/

gsoap-2.8/gsoap/import -I /home/samba/onvif-2013.08.05/gsoap_2.8.15/gsoap-2.8/gsoap/

**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.15

**  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 wsdd service name: wsdd

Using wsdd service style: document

Using wsdd service encoding: literal

Using wsdd service location: http://localhost:80

Using wsdd schema import: http://schemas.xmlsoap.org/ws/2005/04/discovery

Saving wsdd.nsmap namespace mapping table

Using ns1 service name: ActionEngineBinding

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/actionengine/wsdl

Saving ActionEngineBinding.nsmap namespace mapping table

Using ns2 service name: PACSBinding

Using ns2 service style: document

Using ns2 service encoding: literal

Using ns2 service location: http://localhost:80

Using ns2 schema namespace: http://www.onvif.org/ver10/accesscontrol/wsdl

Saving PACSBinding.nsmap namespace mapping table

Using ns4 service name: DoorControlBinding

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/doorcontrol/wsdl

Saving DoorControlBinding.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 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 RuleEngineBinding.nsmap namespace mapping table

Using tdn service name: RemoteDiscoveryBinding

Using tdn service style: document

Using tdn service encoding: literal

Using tdn service location: http://localhost:80

Using tdn schema namespace: http://www.onvif.org/ver10/network/wsdl

Saving RemoteDiscoveryBinding.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 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 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 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 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 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 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 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 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 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 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 SearchBinding.nsmap namespace mapping table

Saving soapClient.c client calling stubs

Saving soapClientLib.c client stubs with serializers (use only for libs)

Saving soapServer.c server request dispatcher

Saving soapServerLib.c server request dispatcher with serializers (use only for libs)

Saving soapC.c serializers

There were errors:

1 semantic error

[[email protected] onvif_new]# 

我們發現,生成過程中有錯誤:

wsa5.h(288): **ERROR**: remote method name clash: struct/class 'SOAP_ENV__Fault' already declared at line 274

可以發現這是由于重複定義導緻,可以修改該檔案。

打開檔案gsoap_2.8.15/gsoap-2.8/gsoap/import/ wsa5.h

将277行int SOAP_ENV__Fault修改為int SOAP_ENV__Fault_alex

再執行指令

[[email protected] onvif_new]# 

[[email protected] onvif_new]# 

[[email protected] onvif_new]# soapcpp2 -c onvif.h -x -I /home/samba/onvif-2013.08.05/gsoap_2.8.15/

gsoap-2.8/gsoap/import -I /home/samba/onvif-2013.08.05/gsoap_2.8.15/gsoap-2.8/gsoap/

**  The gSOAP code generator for C and C++, soapcpp2 release 2.8.15

**  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 wsdd service name: wsdd

Using wsdd service style: document

Using wsdd service encoding: literal

Using wsdd service location: http://localhost:80

Using wsdd schema import: http://schemas.xmlsoap.org/ws/2005/04/discovery

Saving wsdd.nsmap namespace mapping table

Using ns1 service name: ActionEngineBinding

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/actionengine/wsdl

Saving ActionEngineBinding.nsmap namespace mapping table

Using ns2 service name: PACSBinding

Using ns2 service style: document

Using ns2 service encoding: literal

Using ns2 service location: http://localhost:80

Using ns2 schema namespace: http://www.onvif.org/ver10/accesscontrol/wsdl

Saving PACSBinding.nsmap namespace mapping table

Using ns4 service name: DoorControlBinding

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/doorcontrol/wsdl

Saving DoorControlBinding.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 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 RuleEngineBinding.nsmap namespace mapping table

Using tdn service name: RemoteDiscoveryBinding

Using tdn service style: document

Using tdn service encoding: literal

Using tdn service location: http://localhost:80

Using tdn schema namespace: http://www.onvif.org/ver10/network/wsdl

Saving RemoteDiscoveryBinding.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 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 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 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 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 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 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 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 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 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 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 SearchBinding.nsmap namespace mapping table

Saving soapClient.c client calling stubs

Saving soapClientLib.c client stubs with serializers (use only for libs)

Saving soapServer.c server request dispatcher

Saving soapServerLib.c server request dispatcher with serializers (use only for libs)

Saving soapC.c serializers

Compilation successful 

[[email protected] onvif_new]# 

[[email protected] onvif_new]#

可以看到,這次可以成功執行指令,在目前目錄下可以看到生成的源檔案以及不同功能所對應的命名空間。然後我們可以在新生成的源碼上面進行開發。也許有人會覺得代碼量很大,沒關系,我們後續可以裁剪。另外,為了保證onvif所有的功能都包括在裡面,我們必須在最開始開發的時候就生成包含所有功能的檔案。

以上過程的wsdl檔案可以在http://download.csdn.net/detail/u011597695/5875143下載下傳。

後續介紹根據該過程生成的代碼實作onvif發現功能。

繼續閱讀