已阅读5页,还剩48页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
c2wsdl.c测试报告1、获取iSALT.def文件iSALT.def如下:SWAP/12:21552stringsend:inchar500recv:outchar500INSERTVIEW/12:21552view32rid:inoutintrname:inoutlongrsal:inoutchar8INSERTFML/12:21552fml32:FLDTBLDIR32=/tp/salt/simpapp/fml:FIELDTBLS32=regionsrid:inoutlongrname:inoutchar8rsal:inoutchar8aaadd/12:21552view32a:indoubleb:indoubleresult:outdouble2、获取iSALT.dep文件3、生成calc.wsdl文件(简单数据类型)3.1 Linux环境下运行如下命令:gcc -Wall c2wsdl.c -o c2wsdl -I/usr/include/libxml2 -L/usr/lib -lxml2 g3.2 生成wsdl文件./c2wsdl生成简单数据类型的calc.wsdl2011-01-12-15:10:373.3、生成头文件gsoap环境下,根据calc.wsdl生成calc.h文件,运行如下命令:wsdl2h o c calc.h calc.wsdlcalc.h文件内容如下:/ Reminder: Modify typemap.dat to customize the header file generated by wsdl2h/* calc.h Generated by wsdl2h 1.2.10 from example_simple.wsdl and typemap.dat 2010-12-16 02:42:16 GMT Copyright (C) 2001-2008 Robert van Engelen, Genivia Inc. All Rights Reserved. This part of the software is released under one of the following licenses: GPL or Genivias license for commercial use.*/* NOTE: - Compile this file with soapcpp2 to complete the code generation process. - Use soapcpp2 option -I to specify paths for #import To build with STL, stlvector.h is imported from import dir in package. - Use wsdl2h options -c and -s to generate pure C code or C+ code without STL. - Use WS/typemap.dat to control namespace bindings and type mappings. It is strongly recommended to customize the names of the namespace prefixes generated by wsdl2h. To do so, modify the prefix bindings in the Namespaces section below and add the modified lines to typemap.dat to rerun wsdl2h. - Use Doxygen () to browse this file. - Use wsdl2h option -l to view the software license terms. DO NOT include this file directly into your project. Include only the soapcpp2-generated headers and source code files.*/gsoapopt cw/* * * * http:/localhost/calc.wsdl * * */* WSDL Documentation:2010-12-16-10:25:46*/* * * * Import * * */* * * * Schema Namespaces * * */* NOTE:It is strongly recommended to customize the names of the namespace prefixesgenerated by wsdl2h. To do so, modify the prefix bindings below and add themodified lines to typemap.dat to rerun wsdl2h:ns1 = http:/localhost/calc.wsdlns2 = urn:isalt_calc*/gsoap ns2 schema namespace:urn:isalt_calc/gsoap ns2 schema form:unqualified/* * * * Schema Types * * */* * * * Services * * */gsoap ns2 service name:calc /gsoap ns2 service type:calcPortType /gsoap ns2 service port:61:9001/isalt/etc/calc /gsoap ns2 service namespace:urn:isalt_calc /gsoap ns2 service transport:/soap/http /* mainpage calc Definitionssection calc_documentation Documentation2010-12-16-10:25:46section calc_bindings Bindings - ref calc*/*page calc Binding calcsection calc_operations Operations of Binding calc - ref ns2_addsection calc_ports Endpoints of Binding calc - 61:9001/isalt/etc/calcNote: use wsdl2h option -N to change the service binding prefix name*/* * * * calc * * */* * * * ns2_add * * */ Operation ns2_add of service binding calc/*Operation details: - SOAP RPC encodingStyle=/soap/encoding/ - SOAP action=addC stub function (defined in soapClient.cpp generated by soapcpp2):code int soap_call_ns2_add( struct soap *soap, NULL, / char *endpoint = NULL selects default endpoint for this operation NULL, / char *action = NULL selects default action for this operation / request parameters: double a, double b, / response parameters: double *result );endcodeC server function (called from the service dispatcher defined in soapServer.cpp):code int ns2_add( struct soap *soap, / request parameters: double a, double b, / response parameters: double *result );endcode*/gsoap ns2 service method-style:add rpc/gsoap ns2 service method-encoding:add /soap/encoding/gsoap ns2 service method-action:add addint ns2_add( double a,/ Request parameter double b,/ Request parameter double *result/ Response parameter);/* End of calc.h */3.4、开发服务端根据calc.h生成服务端所需存根文件,运行如下命令:Soapcpp2 S c calc.h生成如下文件:VC6.0新建SERVER工程,包含文件如下:其中,calcserver.c需自己开发,内容如下:#include soapH.h#include calc.nsmapint main(int argc, char *argv) SOAP_SOCKET m, s; /* master and slave sockets */ struct soap soap; soap_init(&soap); if (argc 2) soap_serve(&soap);/* serve as CGI application */ else / m = soap_bind(&soap, NULL, atoi(argv1), 100); m = soap_bind(&soap, NULL, 9001, 100); if (!soap_valid_socket(m) soap_print_fault(&soap, stderr); exit(-1); fprintf(stderr, Socket connection successful: master socket = %dn, m); for ( ; ; ) s = soap_accept(&soap); fprintf(stderr, Socket connection successful: slave socket = %dn, s); if (!soap_valid_socket(s) soap_print_fault(&soap, stderr); exit(-1); soap_serve(&soap); soap_end(&soap); return 0; int ns2_add(struct soap *soap, double a, double b, double *result) *result = a + b; return SOAP_OK;运行服务:命令行输入:3.5、开发客户端根据calc.h生成客户端所需存根文件,运行如下命令:Soapcpp2 C c calc.h生成如下文件:VC6.0新建client工程,包含文件如下:其中,calcclient.c需自己开发,内容如下:#include soapH.h#include calc.nsmapconst char server = 61:9001;int main(int argc, char *argv) struct soap soap; double a, b, result; if (argc 4) fprintf(stderr, Usage: add|sub|mul|div|pow num numn); exit(0); soap_init(&soap); a = strtod(argv2, NULL); b = strtod(argv3, NULL); switch (*argv1) case a: soap_call_ns2_add(&soap, server, , a, b, &result); break; default: fprintf(stderr, Unknown commandn); exit(0); if (soap.error) soap_print_fault(&soap, stderr); exit(1); else printf(result = %gn, result); soap_dest
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年河南职业技术学院高职单招笔试职业适应性测验历年参考题库含答案解析
- 2026年沈阳职业技术学院高职单招笔试职业适应性测验历年参考题库含答案解析
- 2026年江西工商职业技术学院高职单招笔试物理历年参考题库含答案解析
- 药品流通高级检查员培训模拟试卷(含答案)
- 血液疾病遗传性球形红细胞增多症题库及参考答案
- 行政职业能力题库带答案
- 西方经济学试题库及参考答案
- 评标专家征集考试题库及参考答案
- 资料员证考试题库及答案
- 辽宁烟草笔试题库及参考答案
- 2025学年保定市十校高二语文上学期期中联考试卷附答案解析
- 2024-2025学年广东省广州市天河区八年级上学期期中数学试卷(含答案)
- 2024年宁波镇海区蛟川街道办事处招聘真题
- 远景能源面试题目及答案
- GJB3206B-2022技术状态管理
- 2025年四川省行政执法资格考试题库及答案
- 2025-2030年中国氟化物分析仪项目投资可行性研究分析报告
- 2025年高中英语教师课程标准考试综合测试题及参考答案
- 养老院短住协议书(2篇)
- 2025年01月新疆交投建设管理有限责任公司面向社会公开招聘笔试历年典型考题(历年真题考点)解题思路附带答案详解
- (高清版)DB52∕T 1284-2018 精准扶贫 易地扶贫搬迁工作管理规范
评论
0/150
提交评论