使用带有gsoap代理类的gsoap独立服务器实现http-get
Implement http get with gsoap standalone server with gsoap proxy classes
我知道如何为gsoap普通代码实现http get,但当我使用gsoap和soapcpp2 -i
生成代码时,我没有可用的soap_server函数,也不知道如何/在哪里重新实现fget/http_get回调
有人试过这个吗?
这很难理解,你试图做什么。我将举一个小的"食谱"示例(C++版本,但C看起来是一样的),这是我不久前用写的
a) 编写正确的服务接口
$cat服务.h
//gsoap ns service name: mon Simple monitor service
//gsoap ns service encoding: literal
//gsoap ns service namespace: http://feniksa.dnsalias.com/hlanmon.wsdl
//gsoap ns service location: http://feniksa.dnsalias.com:8888
//gsoap ns schema namespace: urn:mon
#import "stlvector.h"
int ns__commandsuccess(std::string secret, int commandid, bool& status);
我只创建了一个简单的soap方法:commandsuccess
b) 通过soapcpp 生成服务类
soapcpp2 -S -i -2 -I /usr/share/gsoap/import service.h
请参阅soapcp2输出
gsoap将生成大量文件。参见文件:monService.h和monService.cpp(mon是服务名称),也参见soapH.h
c) 实现服务功能在我的例子中,我添加了monService.cpp函数
int monService::commandsuccess(std::string secret, int commandid, bool &status)
{
// some logic here
return SOAP_OK;
}
d) 查找函数服务或运行。为了我的服务,我在main.cpp 中写了这样的代码
#include "monService.h"
// other includes here
int main(int argc, char* argv[])
{
// init code
monService service;
// other code here
service.serve(); // <- haha, i am here
// other code
}
请参阅:https://freeman.svn.sourceforge.net/svnroot/freeman/other/trunk/gsoap
相关文章:
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- 独立读取-修改-写入顺序
- 使用GSoap实现ONVIF
- 带有多个独立参数的C++For循环
- 使用 mod_gsoap 部署服务时,如何在 Gsoap 中更改 soap 上下文的模式?
- gSoap在从.wsdl创建.h期间出现错误
- 通过命令行在Visual Studio中编译单个独立文件
- 如何将独立的 c 应用程序组合到 c++ 应用程序中?
- 我们能否在stm32f中使用硬件定时器控制两个独立的进程
- antlr 规则上下文是否可以独立于目标
- 查找存储在二叉搜索树的所有非叶子中的数据总和?(返回整数的独立递归函数
- 如何从客户端在 gsoap C++ 的标头中传递非 xml 数据?
- 在使用 gSoap 链接多个 SOAP 服务时启用保持活动状态
- 多个 rocksdb 实例:使用单个共享缓存还是多个独立缓存?
- 在路径的独立Qt项目中包括外部库
- emplace_back初始化列表错误,当初始化列表在独立变量上工作时
- 为什么不同的翻译单元没有独立和沙盒的内存空间?
- gSOAP C++ 多线程独立服务器和客户端示例
- 使用带有gsoap代理类的gsoap独立服务器实现http-get
- 使用gSOAP独立服务器发布wsdl