使用gsoap由.h文件生成wsdl相关问题

2023-10-27

生成wsdl文件步骤

头文件如下

// ws_interface.h

#ifndef  WS_INTERFACE_H
#define  WS_INTERFACE_H
// 注意:以下注释是必要的
//gsoap ns service name: ws_interface
//gsoap ns service style: rpc
//gsoap ns service namespace: https://127.0.0.1:4433/cgi-bin/ws_interface.wsdl
//gsoap ns service location: https://127.0.0.1:4433/cgi-bin
//gsoap ns service executable: ws_interface.cgi
//gsoap ns service encoding: encoded
//gsoap ns schema namespace: urn:ws_interface


typedef struct ns__AddGroupRequest
{
    char *validationCode;
    char *name;
    char *desc;
} ns__AddGroupRequest;

typedef struct ns__AddGroupResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__AddGroupResponse;

typedef struct ns__DelGroupRequest
{
    char *validationCode;
    char *name;
} ns__DelGroupRequest;

typedef struct ns__DelGroupResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__DelGroupResponse;

typedef struct ns__OpGroupRequest
{
    char *validationCode;
    char *name;
    int enable;     // 0 disable, 1 enable
} ns__OpGroupRequest;

typedef struct ns__OpGroupResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__OpGroupResponse;

typedef struct ns__ModifyGroupRequest
{
    char *validationCode;
    char *name;
    char *newname;
} ns__ModifyGroupRequest;

typedef struct ns__ModifyGroupResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__ModifyGroupResponse;

typedef struct ns__AddUserRequest
{
    char *validationCode;
    char *name;
    char *truename;
    char *passwd;
    char *groupname;            // user belong to group name
} ns__AddUserRequest;

typedef struct ns__AddUserResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__AddUserResponse;

typedef struct ns__DelUserRequest
{
    char *validationCode;
    char *name;
} ns__DelUserRequest;

typedef struct ns__DelUserResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__DelUserResponse;

typedef struct ns__OpUserRequest
{
    char *validationCode;
    char *name;
    int enable;     // 0 disable, 1 enable
} ns__OpUserRequest;

typedef struct ns__OpUserResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__OpUserResponse;

typedef struct ns__ModifyUserRequest
{
    char *validationCode;
    char *name;
    char *newname;
    char *truename;
    char *passwd;
    char *groupname;            // user belong to group name
} ns__ModifyUserRequest;

typedef struct ns__ModifyUserResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__ModifyUserResponse;

int ns__AddGroup(
ns__AddGroupRequest *AddGroup,
ns__AddGroupResponse *AddGroupResponse );

int ns__DelGroup(
ns__DelGroupRequest *DelGroupRequest,
ns__DelGroupResponse *DelGroupResponse );

int ns__OpGroup(
ns__OpGroupRequest *OpGroupRequest,
ns__OpGroupResponse *OpGroupResponse );

int ns__ModifyGroup(
ns__ModifyGroupRequest *ModifyGroupRequest,
ns__ModifyGroupResponse *ModifyGroupResponse );

int ns__AddUser(
ns__AddUserRequest *AddUserRequest,
ns__AddUserResponse *AddUserResponse );

int ns__DelUser(
ns__DelUserRequest *DelUserRequest,
ns__DelUserResponse *DelUserResponse );

int ns__OpUser(
ns__OpUserRequest *OpUserRequest,
ns__OpUserResponse *OpUserResponse );

int ns__ModifyUser(
ns__ModifyUserRequest *ModifyUserRequest,
ns__ModifyUserResponse *ModifyUserResponse );

#endif

运行如下命令生成wsdl与源文件:

soapcpp2 -Scd ./ws_interface ./ws_interface.h

关于类型的定义

不能因为某个结构一致,而使用typedef定义别名,这样在生成的wsdl中会有两个同样名字的参数,

而导致wsdl文件出现语法错误

例如,如下的头文件是错误的:

// ws_interface.h

#ifndef  WS_INTERFACE_H
#define  WS_INTERFACE_H

//gsoap ns service name: ws_interface
//gsoap ns service style: rpc
//gsoap ns service namespace: https://127.0.0.1:4433/cgi-bin/ws_interface.wsdl
//gsoap ns service location: https://127.0.0.1:4433/cgi-bin
//gsoap ns service executable: ws_interface.cgi
//gsoap ns service encoding: encoded
//gsoap ns schema namespace: urn:ws_interface

typedef struct ns__CommonResponse
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__CommonResponse;


typedef struct ns__AddGroupRequest
{
    char *validationCode;
    char *name;
    char *desc;
} ns__AddGroupRequest;

typedef struct ns__DelGroupRequest
{
    char *validationCode;
    char *name;
} ns__DelGroupRequest;

typedef struct ns__CommonResponse ns__AddGroupResponse;
int ns__AddGroup(
ns__AddGroupRequest *AddGroup,
ns__AddGroupResponse *AddGroupResponse );

typedef struct ns__CommonResponse ns__DelGroupResponse;
int ns__DelGroup(
ns__DelGroupRequest *DelGroupRequest,
ns__DelGroupResponse *DelGroupResponse );

#endif

关于gsoap生成的返回值

自定义头文件group.h

typedef struct ns__CommonResponse111111111
{
    int returnFlag;
    char *msg;              // message to descript the return_flag
} ns__CommonResponse2222222222;

typedef struct ns__AddGroupRequest
{
    char *validationCode;
    char *name;
    char *desc;
} ns__AddGroupRequest;

int ns__AddGroup(
ns__AddGroupRequest *AddGroupRequest,
ns__CommonResponse2222222222 *CommonResponse );

/

然后用如下命令生成.c文件:

soapcpp2 -S -c group.h

程序运行时,返回的数据被CommonResponse2222222222包裹:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:ws_account"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<ns:CommonResponse2222222222>

<returnFlag>-460</returnFlag>

<msg>group name is empty</msg>

</ns:CommonResponse2222222222>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

注意:soapcpp2 -S -c group.h命令生成的样例res.xml中数据是被CommonResponse111111111包裹,与实际运行程序后生成的数据不符

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用gsoap由.h文件生成wsdl相关问题 的相关文章

  • gRPC那点事

    什么是 gRPC gRPC gRPC Remote Procedure Call 是一种高性能 开源的远程过程调用 RPC 框架 它允许分布在不同计算机上的应用程序能够像调用本地方法一样进行通信 从而实现了在分布式系统中进行高效的通信 传统
  • 手把手教你搭建Scala开发环境 步骤详细

    个人主页 csdn春和 推荐专栏 JavaWeb专栏 从入门到实战超详细 本期文章 搭建Scala开发环境 如果对您有帮助还请三连支持 定会一 一回访 本文目录 一 Scala开发环境搭建 1 1 安装scala 1 2 scala插件安装
  • scala学习-12-scala读取java项目下Src目录下的properties文件

    1 概述 scala读取java项目下Src目录下的properties文件 package scala import java util Properties import java io FileInputStream import s
  • springbootweb请求响应

    web三层架构流程 先是前端传送一个请求给后端 然后controller层接受数据进行处理 传给service层进行逻辑处理再交给dao层 dao层访问数据库 数据库再返回数据给dao层 然后再传给service层处理 最后回到contro
  • ResourceUtils

    ResourceUtils org springframework util ResourceUtils 从资源路径获取文件 判断字符串是否是一个合法的 URL 字符串 static boolean isUrl String resourc
  • Java自动装箱和自动拆箱

    基本类型的包装类 在java中 每一种基本类型都有一个对应的包装类 这些类都在java lang包中 8种基本数据类型所对应的包装类是byte Byte short Short int Integter long Long char Cha
  • 【金融系列】使用Python分析债券,画零息利率曲线,对债券进行精确定价,计算债券的麦考利久期、修正久期和凸度,并进行价格敏感性分析

    目前许多代码和资源在进行债券定价时 大多以债券发行日作为贴现值的时间点 但在实际应用中我们常常需要对早就发行的债券进行定价 这就需要计算准确的现金流 现金流日距离当前贴现时间点的时间距离和不同时间距离的零息利率 这一过程会较多使用插值法 还
  • css中的渐变的属性,CSS3 渐变属性(Gradients)-线性渐变(linearGradient)

    通过使用 CSS3 渐变 gradients 你可以减少下载的事件和宽带的使用 此外 渐变效果的元素在放大时看起来效果更好 因为渐变 gradient 是由浏览器生成的 丛本质上来说 既然 background image 属性中的渐变是浏
  • element框架table多选分页时保留原有选中项(vue2和vue3均适用)

    element中table表格多选 分页 1 表格多选 手动添加一个 el table column 设 type 属性为 selection 即可
  • DLT(Direct Linear Transform)算法

    一 定义 直接线性变换解法是建立像点的 坐标仪坐标 和相应物点的物方空间坐标直接的线性关系的解法 直接线性变换解法的特点 不归心 不定项 不需要内外方位元素的起始值 物方空间需布置一组控制点 特别适合于处理非量测相机所摄影像 本质是一种空间
  • 数据结构常用的算法

    一 排序算法 本质上就是按照某种顺序将一组数排好 分多次重复进行 每次只负责把一个数字放到合适的位置上 两种思路 先确定一个数字 然后根据数据找合适的位置 先确定一个位置 根据位置找合适的数字 1 冒泡排序算法 先确定位置 选最前面或者最后
  • 解决protobuf内存泄漏的3种办法

    1 protobuf对象是如何释放 数组 内存的 毫无疑问是 通过调用析构函数 只要让protobuf定义的对象调用析构函数 无论嵌套了多少层数据 包含了多少个数组都可以释放new出来的内存 2 protobuf对象Clear 接口和STL
  • clickhouse系列第三篇之clickhouse客户端使用教程(1.命令行客户端连接)

    文章目录 一 客户端支持的配置项 1 配置项的配置方式 1 1 从命令行传入 1 2 配置文件 2 配置项列表 二 客户端用法 1 非交互模式 1 1 query 参数指定执行语句 1 2 query 参数和发送到stdin的数据联合使用
  • JVM -- 类加载(七)

    一 加载 将类的字节码载入方法区中 内部采用 C 的 instanceKlass 描述 java 类 它的重要 field 有 java mirror 即 java 的类镜像 如对 String 来说 就是 String class 作用是
  • 前端 报错处理(长期更新 2023.9.06)

    目录 一 ECharts 相关 1 1 Error yAxis 0 not found 1 2 Cannot read properties of undefined reading 0 1 3 Cannot read properties
  • Python编程:从入门到实践 动手试一试之8-6

    根据之前学习的返回字典先写了一版 定义函数city countyr 并定义两个形参guojia和city def city country guojia city 定义函数国家和对应的城市 C city guo guojia chen ci

随机推荐

  • 推荐微信小程序常用的几个UI组

    1 WeUI WeUI 是一套同微信原生视觉体验一致的基础样式库 由微信官方设计团队为微信 Web 开发量身设计 可以令用户的使用感知更加统一 包含button cell dialog progress toast article acti
  • ubuntu下安装软件的方法

    一 ubuntu下软件安装 ubuntu系统下 软件安装方法有几种 常用的方法如下 1 使用 apt 工具安装 2 deb 软件包安装 3 自己下载程序源码编译安装 4 通过 ubuntu系统自带的软件中心安装 这种方法不常用 因为一直不太
  • python中SSL/TLS认证失败的解决方案

    重装了ubuntu22 04版本的系统后 跑yolov5的train py脚本时出现以下报错 原因是本地计算机上缺少了需要的根证书 File home anaconda3 envs py37 lib python3 7 urllib req
  • PaddleGAN

    产品动态 人脸编辑神器 StyleGAN V2人脸属性编辑之年龄变换 时光穿梭机 一键实现变老变年轻 完整在线教程 视频超分SOTA算法PP MSVSR 一行命令从 马赛克 到 高清影像 完整在线教程 人脸编辑神器 StyleGAN V2人
  • 爬虫日常练习-艾图网单页面图片爬取

    文章目录 爬虫练习 分析网站 代码设计 下载图片 完整代码 爬虫练习 hello 大家好 好久不见了 无聊的网友今天开始更新关于爬虫的一些日常练习 每次学习完一个新的知识后没有多的案例给自己练习真的很不舒服 希望该系列文章能够让刚刚开始学习
  • 【Linux】调试器---gdb的使用

    文章目录 一 背景知识 二 安装gdb 三 gdb的用法 使用须知 gdb的常用指令 1 进入调试 2 退出调试操作 3 显示源代码 4 设置断点breakPoint 5 查看断点信息 禁用断点 开启断点 删除断点 6 运行程序 开始调试r
  • 开发者自述:我是怎样理解支持向量机(SVM)与神经网络的

    https www leiphone com news 201705 v10u2BOvGHEbzBpV html 写在前面 囫囵吞枣看完SVM 个人感觉如果不好好理解一些概念 或说如果知其然而不知其所以然的话 不如不看 因此我想随便写一写
  • 03MySQL数据库表练习

    第一题 1 创建数据库 mysql gt create database Market 2 创建数据表customers 在c num字段上添加主键约束和自增约束 在c birth字段上添加非空约束 mysql gt use Market
  • 二进制,八进制,十进制,十六进制相互转换的快速记忆法

    1 十进制转换为R进制 都是使用除数取余法来转换 结果按倒序来 a 十进制转换为二进制 就一直除以2 直到余数比2小 商为0为止 b 十进制转换为八进制 就一直除以8 直到余数比8小 商为0为止 c 十进制转换为十六进制 就一直除以16 直
  • 2023/09/19 qt day3

    头文件 ifndef WIDGET H define WIDGET H include
  • java String转数组

    java String转数组 String转集合 将字符串转化为数组 如果你和我一样你们公司有人这样存数据的话 这就很气人 如果用分割的方法的话 还需要去除前后两个中括号 还有两个双引号要分割 气死人 所以想要转数组例如 arr a b c
  • 解决fastjson解析List对象出现{“$ref“:“$.data[0]“}的问题

    返回数据问题 例子 List
  • Linux 实验六

    编写 段bash shell程序 保存为 program sh 完成以下输出 可循环执 please input a number 5 回 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 bin bash echo please
  • Linux网络编程:多进程实现TCP通信

    服务器端代码 TCP 通信的服务器端 多进程实现并发服务器 父进程accept 子进程用于通信 include
  • linux如何运行ipynb文件_怎么在Jupyter里打开ipynb文件

    方法一 1 在使用Anaconda集成环境安装TensorFlow时 里面自带安装 Jupyter 安装完成后 打开开始菜单找到Anaconda3 64 bit 点击Anaconda Prompt 类似windows的命令行工具 2 在命令
  • QT怎么发送带结构体数据的信号?

    当发送的信号是结构体时 第一步 定义一个结构体 并在包含该结构体的类里面注册该结构体 通过此方法Q DECLARE METATYPE T 第二步 作为信号输出时 不能直接传结构体 要先包装一下结构再传出去 接收时 也要拆开包装 才能拿到数据
  • docker 镜像/容器的打包、导出、导入

    目录 一 将变动过的容器打包生成新的镜像 二 对镜像进行导出导入 1 将镜像导出为一个镜像img文件 2 将img镜像文件导入 复制出一个完全一样镜像 三 对容器进行导入导出 1 将容器导出为一个镜像tar文件 2 将镜像tar文件导入 生
  • vuejs项目纯js导出word、在线下载富文本内容或者网页另存为word文件

    所有前端导入导出方法集合 前端必备技能知识 JS导出Blob流文件为Excel表格 Vue js使用Blob的方式实现excel表格的下载 流文件下载 勤动手多动脑少说多做厚积薄发 CSDN博客 js文件流导出excel表格效果 重点 a
  • 【有奖调研】

    2022年 区块链价值被不断挖掘 成为Web3 元宇宙 数字藏品等众多产业的基石 我们面向广大开发者以及区块链爱好者发起本次调研 以了解大家对这项极具潜力的新技术的认知 为感谢大家的认真作答 我们将从有效问卷中随机抽取30名幸运者 赠送精品
  • 使用gsoap由.h文件生成wsdl相关问题

    生成wsdl文件步骤 头文件如下 ws interface h ifndef WS INTERFACE H define WS INTERFACE H 注意 以下注释是必要的 gsoap ns service name ws interfa