没有合适的资源?快使用搜索试试~ 我知道了~
首页gSOAP服务开发指南V2._0.doc
gSOAP服务开发指南V2._0.doc
4星 · 超过85%的资源 需积分: 10 57 下载量 164 浏览量
更新于2023-03-16
评论
收藏 176KB DOC 举报
gSOAP服务是基于gSOAP C++工具包开发的,支持SOAP协议的Web Services 服务。gSOAP工具包包含了工具和库。工具用于根据服务定义文件(.h文件或者.wsdl文件)生成服务框架,库与服务框架一起,负责完成SOAP协议的解析工作。Cygwin gSOAP服务利用HTTP WEB服务器作为前端,处理HTTP请求。HTTP WEB服务器与gSOAP服务之间通过FastCGI协议进行通讯。 目前,测试过的HTTP服务器包括Lighttpd/IBM HTTP Server。标准的J2EE Application Server通过jFastCGI包也可以作为前端HTTP服务器。目前测试过的J2EE Server包括WebLogic和WebSphere。
资源详情
资源评论
资源推荐
gSOAP 服务开发指南
1 概述
gSOAP 服务是基于 gSOAP C++工具包开发的,支持 SOAP 协议的 Web Services 服务。
gSOAP 工具包包含了工具和库。工具用于根据服务定义文件(.h 文件或者.wsdl 文件)生成服务
框架,库与服务框架一起,负责完成 SOAP 协议的解析工作。Cygwin
gSOAP 服务利用 HTTP WEB 服务器作为前端,处理 HTTP 请求。HTTP WEB 服务器与
gSOAP 服务之间通过 FastCGI 协议进行通讯。
目前,测试过的 HTTP 服务器包括 Lighttpd/IBM HTTP Server。标准的 J2EE Application
Server 通过 jFastCGI 包也可以作为前端 HTTP 服务器。目前测试过的 J2EE Server 包括
WebLogic 和 WebSphere。
作者:羊笑佺 审核人: - 1 -
sysmanager.cgi
(fastcgi 进程 )
HTTP 服务器
order.cgi
(fastcgi 进程 )
Oracle Database
2 服务端开发
2.1 开发流程
下表列出了 gSOAP 服务的开发流程以及与 Tuxedo 服务开发流程的对比。可以看出 ,
gSOAP 与 Tuxedo 开发是相似的。
gSOAP 服务 Tuxedo 服务
1
定义服务方法(Service.h 文件) 定义接口(.idl 文件)
2
生成服务框架和 WSDL(soapcpp2) 生成服务框架(idl -i *.idl)
3
补充服务实现(Service.cpp) 补充服务实现(_i.cpp)
4
编译服务(g++) 编译服务(buildobjserver)
5
部署服务 部署服务
2.2 定义服务方法
服务和方法通过 C++头文件的形式来定义。
首先需要定义服务本身的一些属性,下面列出必须的属性:
服务名称(service name)
命名空间(service namespace)
服务位置(service location)
这些属性在头文件中以“//gsoap <命名空间前缀> <属性名称> : <属性值>”形式定义。
例如下面的代码:
//File: soaservice.h
作者:羊笑佺 审核人: - 2 -
//gsoap ns1 service name: SOAService
//gsoap ns1 service namespace: urn:soaservice
//gsoap ns1 service location: http://localhost/ws/soaservice
定义了命名空间前缀 ns1 的服务名称为 SOAService,命名空间为 urn:soaservice,位置
为 http://localhost/ws/soaservice。
接着定义服务中的方法。
方法返回值统一为 int 型,方法名称要求符合“命名空间前缀__方法名”的形式。输入输出
参数支持简单类型,也支持 struct 结构。对于 std::string 类型的输入输出参数或者结构成员,
需 要 写 成 xsd__string 和 xsd__string& 的 形 式 ( 通 过 typedef 将 xsd__string 定 义 为
std::string),以便于 gSOAP 编译器在生成 WSDL 时,转换成 xsd::string 类型。
输出参数的类型后需要加&。
例如下面的代码:
typedef std::string xsd__string;
struct ns1__npRequestRequest
{
xsd__string MessageID;
xsd__string CommandCode;
//……
};
struct ns1__npRequestResponse
{
xsd__string MessageID;
//……
作者:羊笑佺 审核人: - 3 -
};
int ns1__npRequest( \
struct ns1__npRequestRequest r_input, \
struct ns1__npRequestResponse& r_output);
定义了 npRequest 方法,输入参数为 ns1__npRequestRequest 类型的结构,输出参数
为 ns1__npRequestResponse 类型的结构。
为了实现在一个程序中实现多个服务端,客户端共存,需要通过 C++ namespace 的方式
将整个定义包含在一个命名空间中。即用 namespace NamespaceName { … }将上面的整个
定义包括起来。
完整的 soaservice.h 定义如下:
namespace SOAService {
//File: soaservice.h
//gsoap ns1 service name: SOAService
//gsoap ns1 service namespace: urn:soaservice
//gsoap ns1 service location: http://localhost/ws/soaservice
typedef std::string xsd__string;
struct ns1__npRequestRequest
{
xsd__string MessageID;
xsd__string CommandCode;
xsd__string ServiceType;
xsd__string NpCode;
xsd__string FlowID;
作者:羊笑佺 审核人: - 4 -
xsd__string RequestID;
xsd__string PortOutNetID;
xsd__string PortInNetID;
xsd__string HomeNetID;
xsd__string UserName;
xsd__string CredType;
xsd__string CredNumber;
xsd__string Telephone;
xsd__string ReqTime;
xsd__string Name2;
xsd__string CredType2;
xsd__string CredNumber2;
xsd__string Remark;
};
struct ns1__npRequestResponse
{
xsd__string MessageID;
xsd__string CommandCode;
xsd__string ResponseCode;
xsd__string ErrorMessage;
};
int ns1__npRequest(struct ns1__npRequestRequest r_input, struct ns1__npRequestResponse&
r_output);
}
作者:羊笑佺 审核人: - 5 -
剩余25页未读,继续阅读
czhsxwch
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论6