onvif學習之gsoap簡單例項
以下內容是來自網上,加上自己的試驗得來,不能算原創,這裡要感謝“onvif規範的實現:使用gSOAP建立SOAP呼叫例項”的作者!
1,設定環境變數,這裡我寫了一個指令碼,直接執行指令碼就能直接配置環境變數:
echo "set the environment for gsoap.....!"
GSOAP_PATH=$PWD/gsoap_install/bin/
export PATH=$GSOAP_PATH:$PATH
設定好後,直接執行
2,根據標頭檔案生成c程式碼:
首先需要一個x.h檔案,這個檔案我是抄的網上的:
然後生成c程式碼:
** The gSOAP code generator for C and C++, soapcpp2 release 2.8.12
** Copyright (C) 2000-2012, 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 input declarations
Using ns2 service name: Service
Using ns2 service style: document
Using ns2 service encoding: literal
Using ns2 service location:http://localhost:80
Using ns2 schema namespace:http://tempuri.org/ns2.xsd
Saving ns2.wsdl Web Service description
Saving ns2.add.req.xml sample SOAP/XML request
Saving ns2.add.res.xml sample SOAP/XML response
Saving ns2.xsd XML schema
Saving ns2.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 soapH.h interface declarations
Saving soapC.c XML serializers
Compilation successful
[email protected]:/workdir/private/onvif/workdir/demo# ls
add.h ns2.add.res.xml ns2.wsdl soapC.c soapClientLib.c soapServer.c soapStub.h
ns2.add.req.xml ns2.nsmap ns2.xsd soapClient.c soapH.h soapServerLib.c
可以看到生成了很多c程式碼,這樣框架程式碼就生成了。
3,下面我們來完成DEMO程式碼:
3.1addserver.c
[email protected]:/workdir/private/onvif/workdir/demo# cat addserver.c
#include "soapH.h"
#include "add.nsmap"
int main(int argc, char **argv)
{
int m, s;
struct soap add_soap;
soap_init(&add_soap);
soap_set_namespaces(&add_soap, namespaces);
if (argc < 2) {
printf("usage: %s <server_port> \n", argv[0]);
exit(1);
} else {
m = soap_bind(&add_soap, NULL, atoi(argv[1]), 100);
if (m < 0) {
soap_print_fault(&add_soap, stderr);
exit(-1);
}
fprintf(stderr, "Socket connection successful: master socket = %d\n", m);
for (;;) {
s = soap_accept(&add_soap);
if (s < 0) {
soap_print_fault(&add_soap, stderr);
exit(-1);
}
fprintf(stderr, "Socket connection successful: slave socket = %d\n", s);
soap_serve(&add_soap);
soap_end(&add_soap);
}
相關推薦
onvif學習之gsoap簡單例項
以下內容是來自網上,加上自己的試驗得來,不能算原創,這裡要感謝“onvif規範的實現:使用gSOAP建立SOAP呼叫例項”的作者! 1,設定環境變數,這裡我寫了一個指令碼,直接執行指令碼就能直接配置環境變數: echo "set the environment for
Linux學習之路 -- 簡單日常使用命令
簡單 日誌 reboot logs netstat oca yum a.out mysql tail -f catalina.out #在 logs 下面查看日誌( -f 實時查看) rm -rf /var/log/httpd/access
入門VMware Workstation下的Debian學習之Vim簡單使用(三)
上一個 onf 安裝 es2017 左移 let 可用 style 重做 什麽是Vim? Vim具有程序編輯的能力,可以主動的以字體顏色辨別語法的正確性,方便程序設計。 Vim是從vi發展出來的一個文本編輯器。代碼補完、編譯及錯誤跳轉等方便編程的功能特別豐富,在程序
springboot學習之構建簡單項目搭建
per 獨立 response body run 5.5 close ring mco 概述 相信對於Java開發者而言,spring和springMvc兩個框架一定不陌生,這兩個框架需要我們手動配置的地方非常多,各種的xml文件,properties文件,構建一個項目
Unity3d學習之路-簡單AR遊戲
簡單AR遊戲 簡單AR遊戲 遊戲規則 遊戲實現 遊戲場景的搭建 遊戲邏輯的實現 遊戲指令碼
Unity3d學習之路-簡單選擇板
簡單選擇板 簡單選擇板 實現要求 實現過程 基礎UI設定 實現遊戲邏輯 UI與遊戲邏輯的結
Unity3d學習之路-簡單粒子製作
簡單粒子製作 簡單粒子製作 實現要求 實現過程 製作魔法球和特效粒子 實現沿路徑移動
Unity3d學習之路-簡單巡邏兵
簡單巡邏兵 簡單巡邏兵 遊戲規則與遊戲要求 遊戲UML類圖 遊戲實現 巡邏兵部分
Unity3d學習之路-簡單打靶遊戲
簡單打靶遊戲 簡單打靶遊戲 遊戲規則與遊戲要求 遊戲UML類圖 遊戲實現 靶建立部分 弓移動部
Unity3d學習之路-簡單打飛碟(介面卡模式)
簡單打飛碟(介面卡模式) 簡單打飛碟(介面卡模式) 遊戲要求 介面卡模式 遊戲實現 介面卡實現
Unity3d學習之路-簡單打飛碟小遊戲
簡單打飛碟小遊戲 簡單打飛碟小遊戲 遊戲規則與遊戲要求 遊戲UML類圖 遊戲實現過程 動作部分
Unity3d學習之路-簡單井字棋
Unity3d-簡單井字棋 作業目的:熟悉IMGUI的使用,和基礎的Unity3d操作 遊戲玩法:選擇兩個模式,1.Player vs Player 2.Computer vs Player,當其中一種棋子連成三個則這個棋子的玩家獲勝。 技術限制:僅允許使用I
python學習之sellinum簡單建立。
首先進行了簡單的程式碼測試。 #-*- encoding=utf-8 -*- from selenium import webdriver browser = webdriver.Chrome() browser.get("http://www.baidu.com") browser
python學習之最簡單購物車
1、啟動程式後,,讓使用者輸入現金,然後列印商品列表2、允許使用者根據商品編號購買商品3、使用者選擇商品後,檢測餘額是否夠,夠就直接扣款,不夠就提醒4、可隨時退出,退出時,列印已購買商品和餘額這個題要用到:1.input 2.購物車設為字典,買一件新增一件 3.for列印商品列表4.while 可以持續新增
python學習之實現簡單的miniWeb伺服器
webServer部分: #!/usr/bin/venv python3 # coding: utf-8 import socket import multiprocessing import re import dynamic.WebFrame as WebFra
springboot學習之構建簡單專案搭建
概述 相信對於Java開發者而言,spring和springMvc兩個框架一定不陌生,這兩個框架需要我們手動配置的地方非常多,各種的xml檔案,properties檔案,構建一個專案還是挺複雜的,在這種情況下,springboot應運而生,他能夠快速的構建spring專案,而且讓專案正常執行起來的配置檔案
Linux學習之網路相關例項應用
1、100.0.0.16/28對應網段的閘道器地址、廣播地址、可分配IP地址範圍。 28位掩碼,掩碼為255.255.255.240,前28位表示網路地址, 後四位表示可分配的主機,所以可分配的IP地址範圍為100.0.0.17到100.0.0.30 廣播地址為100.0.0.31,閘道
Linux學習之磁碟管理例項
1、描述GPT,應該怎麼使用 1)GPT描述 GPT——全域性唯一標識分割槽表(GUID Partition Table,縮寫:GPT)是一個實體硬碟的分割槽結構。它是EFI(可擴充套件韌體介面標準)的一部分,用來替代BIOS中的主引導記錄分割槽表。但因為MBR分割槽表不支援容
機器學習之實現簡單的神經網路
機器學習的本質是模擬人的神經元對資訊的處理方法。可以將神經元看成是一個簡單的帶有二進位制輸出功能的邏輯電路門,多種電訊號可以從神經元的樹突部分傳入,然後對多個傳入的電訊號進行結合,統一地運算,得到的唯一的電訊號會通過神經元的軸突–>神經末梢傳遞給其他神經元
linux C學習之實現簡單的web伺服器
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h