GSoap工具的安装和使用

上传人:daj****de 文档编号:119686790 上传时间:2022-07-15 格式:DOCX 页数:9 大小:106.19KB
返回 下载 相关 举报
GSoap工具的安装和使用_第1页
第1页 / 共9页
GSoap工具的安装和使用_第2页
第2页 / 共9页
GSoap工具的安装和使用_第3页
第3页 / 共9页
点击查看更多>>
资源描述
7.4GSOAP 工具的安装和使用7.4.1GSOAP 安装GSOAP工具可以在WIN和UNIX两个系统平台下运行,这就使我们的程序在跨平台上有了基础。工 具的安装包可浏览其主页下载。本DEMO的开发使用的版本为gsoap_win32_2.7.91,工具的运行环境是 Windows 系统。gsoap_win32_2.7.91.zip5,269 KB图 7.12 Windows 下的 GSOAP 安装包gsoap-2.7.9di 门 ux-bin.zip6,773 KB图7.13 LINUX或UNIX下的GSOAP安装包设置系统环境变量,这样可以很方便的使用GSOAP工具,如下为GSOAP的两个工具,我们将他们设置到可以在DOS下可直接使用的程序。图7.14 GSOAP两个工具程序GSOAP方法一wsdl2h.exe方法二h文件Wsdl2h在根据已有WSDL生成客户 端和服务端框架文件时使用,此工 具生成.h文件I自己编写*.h文件,空间、复杂数据类型、方法声明 (带输入输出参数)文件内容为命名*.h文件soapcpp2.exesoapStub.h soapH.h soapC.cpp soapClient.cpp远程操作的客户机存根例程soapServer.cpp服务端存根例程Stdsoap2.hStdsoap2.cpp*.n smap*.req.xml*.res.xmlsoapcpp2.exe从输入Header文件生成的经过修改且带标注的H eader文件 主H eader文件,所有客户机和服务源代码都要将其包含在内 指定数据结构的序列化器和反序列化器stdsoap2.cpp运行时库的H eader文件运行C+库,带XML解析器和运行时支持例程 命名空间文件请求SOAP消息格式回应SOAP消息格式图7.15 GSOAP使用方法742生成客户端文件Wsdl2h.exe的参数说明参见7.5.1节图 7.16 在 DOS 下使用 wsdl2h.exe 工具生成 SendSMSClient.h 文件* The gSOAP USDL parser for C and C+ 1.2.91* Copyright 2000-2007 Robert uan Engelen, Geniuia Inc.* A11 Rights Reserued. This product is prouided ,Ras isR, without any warranty * The gSOAP USDL parser is re leased under one of the following tuo licenses: * GPL or the conimercial license by Geniuia Inc. Use opt ion -1 for more inf o.Sau ing SendSMSClient.hCannot open file 1typemap.datf Problem reading type map file tpemap.dat. Using internal type def in it ions for C+ insteadConnect ing to 1http:/localhost/sms/ctcc_sms_send_seruice_2_l.wsdl, to retrieue USDL/XSD. connected, receiuing.Connecting to *http:/localhost/sms/ctcc_sms_send_interface_2_l.wsdl, to retrieu e relatiue *ctcc_sms_send_interface_2_l.wsdl, USDL/XSD. connected, receiuing.Connecting to 1 http:/localhost/sms/ctcc_common_faults_2_0.wsdl* to retrieue re 1 atiue *ctcc_common_faults_2_0.wsdl, USDL/XSD. connected, receiuing.Connect ing to *http:/localhost/sms/ctcc_common_types_2_l.xsd* to retrieue relat iue *ctcc_common_types_2_l.xsd, schema. connected, receiuing.Warning: schema uithout namespace, assigning ZctccZsmsZsend/u2_lZinterfaceConnecting to *http:/localhost/sms/ctcc_sms_types_2_l.xsd, to retrieue relatiue *ctcc_sms_types_2_l.xsd, schema. connected, receiuing.To complete the process, compile uith: soapcpp2 SendSMSClient.h图7.17生成成功片 SendSMSClient.hJ 匚J匚+ Header图 7.18 生成的文件(短信为例)Soapcpp2.exe 工具的参数说明参见 7.5.2 节图7.19根据.h生成客户端的文件* The gSOAP Stub and Skeleton Compiler for C and C+ 2.7.91* Copyright 2000-2007, Robert van Engelen, Geniuia Inc.* All Rights Reserved. This product is provided as is, without any warranty.* The gSOAP compiler is released under one of the Follouing three licenses: * GPL, the gSOAP public license, or the cornnercial license by Geniuia Inc.Saving soapStub.hSaving soapH.hSaving soapC.cppSaving soapClient-cppSaving soapClientLib.cppUsing nsl Using nsl Using nsl Using nsl Using nslseruice name: SendSmsBindingseruice style: documentseruice encoding: literalseruice location: http:/221.236.6.218 =5080/isag/North/SMS/SendSms schema namespace: Ll/seruiceSaving soapSendSmsBindingProxi/.h client proxySaving SendSmsBinding.sendSms.req.xml sample SOAP/XML requestSaving SendSmsBinding.sendSins .res .xml sample SOAP/XML responseSaving SendSmsBinding-sendSmsLogo.req.xml sample SOAP/XML requestSaving SendSmsBinding.sendSinsLDgD .res .xml sample SOAP/XML responseSaving SendSmsBinding.sendSmsRingtone.req.xml sample SOAP/XML requestSaving SendSmsBinding.sendSinsRingtDne .res .xml sample SOAP/XML response Saving SendSmsBinding.getSmsDeliueri/Status .req.xml sample SOflP/XML request Saving SendSmsBinding.getSmsDeliueri/Status .res .xml sample SOflP/XML response Saving SendSmsBinding.nsmap namespace mapping tableCompilation successful图 7.20 生成成功提示信息pendSmsBinding. getSmsDeiiveryStatus .req. xiri” SendSinsBincling.getSinsDeliveryStatus.res.xinl 画 SendSirisBinding.nsmap兰 SendSinsBincling.sendSins.req.xml兰 SendSinsBinding.sendSins.res.xnnl学 SendSmsBinding.sendSmsLogo.req.xmlSendSinsBinding.sendSinsLogo.res.KinlSendSmsBinding. sendSmsRingtone. req. xml 空 SendSmsBinding. sendSmsRingtone. res. xml Jsoap 匚.匸口口 92|soap匚lie门匕匚口口 Qlflsoap 匚 li 日门 tLih,匚 口口 _fj soapH.h”1 soapSendSmsBindingProxy.hM soapStub.h图 7.21 生成的客户端文件文件名文件描述soapStub.h从输入Header文件生成的经过修改且带标注的Header文件soapH.h主Header文件,所有客户机和服务源代码都要将其包含在内soapC.cpp指定数据结构的序列化器和反序列化器soapClie nt.cpp远程操作的客户机存根例程soapServer.cpp服务端存根例程Stdsoap2.hstdsoap2.cpp运行时库的Header文件Stdsoap2.cpp运行C+库,带XML解析器和运行时支持例程*.n smap命名空间文件*.req.xml请求SOAP消息格式*.res.xml回应SOAP消息格式表 7.1 生成文件的说明其他文件在项目中没有使用,在此不做介绍,如需了解参看网络资料。7.4.3 生成服务端文件Wsdl2h.exe 的参数说明参见 7.5.1 节C: wsdl2h -s -o SMSSeruer .h http:/localhost/SnisNot ify/ctcc_sms_not if icat ion_s ruice_2_l .usdl* The gSOflP USDL parser for C and C+ 1.2.91* Copyright 2000-2007 Robert uan Engelen, Geniuia Inc.* All Rights Reserued. This product is prouided ,Ras isR, uithout einy warranty* The gSOflP USDL parser is released under one of the Follouing tuo licenses: * GPL or the commercial license by Geniuia Inc. Use option -1 for more info.Sauing SMSSeruer.hCannot open file 1typemap.datJProblem reading type map File tpemap.dat.Using internal type definitions for C+ instead.Connecting to http:/localhost/SnisNotify/ctcc_sms_notif ication_seruice_2_1 .usd to retrieue USDL/XSD. connected, receiving.Connecting to http:/localhost/SnisNot ify/ctcc_sms_not if icat ion _int erf ace _2_1. h dlJ to retrieue relatiue 1 ctcc_sms_notification_interface_2_l.wsdl, USDL/XSD. connected, receiving.Connecting to * http:/localhost/SnisNotiFy/ctcc_sms_types_2_l .xsdJ to retrieue r latiue 1 ctcc_sms_types_2_l.xsdJ schema. connected, receiving.Connecting to * http:/localhost/SnisNotify/ctcc_conimon_types_2_l .xsdJ to retrieu relatiue * ctcc_comnion_types_2_l .xsdJ schema. . . connected, receiving.To complete the process, compile uith: soapcpp2 SMSSeruer.h图7.22创建WEB SERVICE的.h文件片 SMSServer.hp| j 匚/匚+ Header图 7.23 生成的文件Soapcpp2.exe 工具的参数说明参见 7.5.2 节C:Tempsoapcpp2 -S ./SMSSeruer.h* The gSOAP Stub and Skeleton Compiler for C and C+ 2.7.91* Copyright 2000-2007, Robert uan Engelen, Geniuia Inc.* All Rights Reserued. This product is prouided as is, uithout anv warranty* The gSOAP compiler is re leased under one of the following three licenses: * GPL, the gSOAP public license, or the conimercial license by Geniuia Inc.Sauing soapStub.h Sauing soapH.hSauing soapC.cppSauing soapSeruer.cpp Sauing soapSeruerLib.cppUs ing nsl seru ice name:SmsNot if icat ionBindingUs ing nsl seru ice Us ing nsl seru icestyle: document encoding: literalUs ing nsl seru icelocation: http:/localhost:9080/SmsNotificationSeruice/seruices/SmsNot if icat ionUs ing nsl schema namespace: at ion/u2_l/seruiceSauing soapSmsNotificationBindingObject.h seruer objectSauing SmsNotificationBinding.notifvmsReception.req.xml sample SOAP/XML requestSauing SmsNotificationBinding.notifvmsReception.res.xml sample SOAP/XML respons eSauing SmsNotif icationBinding.notif vSmsDeliuereceipt .req.xml sample SOAP/XML r equestSauing SmsNotificationBinding.notifySmsDeliueryReceipt.res.xml sample SOAP/XML r esponseSauing SmsNotificationBinding.nsmap namespace mapping tableCompilat ion successful图 7.24 生成 WEB SERVICE 服务端文件lpmsNotificationBinding. notify SmsDeliveryReceipt. req. xml i兰 SmsNotificationBinding.notifySmsDeliveryReceipt.res.xml l= SmsNotifi 匚日 tiizi 门 Eiindi 门 q notifySmsRe 匚 epthun,eq. xml 兰 SmsNotificationBinding.notifySmsReception.res.xml 盘 SmsNotificationBinding. nsmapsoap匚,匚匚i匚i_n soapH. h*3 soapServer. cppsoapServerLib.匚匚ip丄soapSmsNotificationBinclingObject. h川soapStub. h图 7.25 生成的服务端文件7.5GSOAP 工具的参数soapcpp2.exe: gSOAP编译器,编译头文件生成服务器和客户端都需要的C/C+文件。wsdl2h.exe:编译wsdl文件生成C/C+头文件。7.5.1wsdl2h.exe 的使用wsdl2h是将wsdl定义转换成.h文件的工具。主要有一些选项:-c代表转化成C代码。-s代表不使用STL,取而代之需要在工程中包含stdsoap2.h和stdsoap2.cpp。-o file 代表指定输出文件名称。通常情况下使用命令wsdl2h s xxx.wsdl即可生成想要的.h文件详细参数说明为:Usage: wsdl2h -a -c -d -e -f -g -h -I path -j -l -m -n name -N n ame -p -q n ame -r proxyhost:port -s -t typemapfile.dat -u-v -w -x -y -z -_ -o outfile.h infile.wsdl infile.xsd http:www.-agen erate in dexed struct n ames for local eleme nts with anony mous types-c gen erate C source code-d use DOM to populate xs:a ny and xsd:a ny Type eleme nts-e dont qualify enum n ames-f gen erate flat C+ class hierarchy-ggen erate global top-level eleme nt declarati ons -h display help info-Ipath use path to find files-jdont gen erate SOAP_ENV_Header a nd SOAP_ENV_Detail defin iti ons-lin clude lice nse inf ormati on in output-m use xsd.h module to import primitive types-nn ame use n ame as the base n amespace prefix in stead of ns-Nname use name as the base namespace prefix for service namespaces-ofile output to file-p create polymorphic types with C+ in herita nee with base xsd_any Type -qn ame use n ame for the C+ n amespace for all service declarati ons -rhost:portconn ect via proxy host and port-s dont gen erate STL code (no std:str ing and no std:vector)-tfile use type map file in stead of the default file typemap.dat-u dont gen erate unions -v verbose output-w always wrap resp onse parameters in a resp onse struct (=1.1.4 behavior) -x dont gen erate _XML any/any Attribute exte nsibility eleme nts-y gen erate typedef synon yms for structs and en ums-z gen erate poin ter-based arrays for backward compatibility gSOAP 2.7.6e -_ dont gen erate _USCORE (replace with UNICODE _x005f)in file.wsdl in file.xsd http:/www. list of in put sources (if none: use std in)752soapcpp2.exe 的使用soapcpp2是生成源码的工具,从某种意义上来说,WebService和ICE相当的相像。都是网络通信协议的 封装方式,所不同的是WebService使用的是公开协议。没有特殊选项的情况下,gsoap不需要依赖其他的 链接库。 soapcpp2 的主要选项有(注意区分大小写):-C 代表生成客户端代码。-S 代表生成服务端代码。-L 代表不生成 soapClientLib/soapServerLib-c 代表仅生成 c 代码-i 代表使用 Proxy通常情况下使用命令soapcpp2 -S/-C -L -i xxx.h详细参数说明为:Usage: soapcpp2 -1|-2 -C|-S -L -a -c -d path -e -h -i -I path;path;. -1 -m -n -p name -s -t -v -w -x i nfile-1gen erate SOAP 1.1 bi ndi ngs-2gen erate SOAP 1.2 bindings-Cgen erate clie nt-side code only-Sgen erate server-side code only-Ldont gen erate soapClie ntLib/soapServerLib-ause value of SOAPActi on HTTP header to dispatch method at server side-cgen erate C source code-dpathuse path to save files-egen erate SOAP RPC en cod ing style bindings-hdisplay help info-igen erate service proxies and objects in herited from soap struct-Ipathuse path(s) for #import-lgen erate lin kable modules (experime ntal)-mgen erate Matlab(tm) code for MEX compiler-nuse service n ame to ren ame service fun cti ons and n amespace table-pn ame save files with new prefix n ame in stead of soap-sgen erate deserializati on code with strict XML validati on checks-tgen erate code for fully xsi:type typed SOAP/XML messag ing-vdisplay versi on info-wdont gen erate WSDL and schema files-xdont gen erate sample XML message filesin file header file to parse (or std in)7.5.3stdsoap2.h 和 stdsoap2.cpp文件说明stdsoap2.h 匚/匚+ Header 77 KB图 7.26 stdsoap2.cpp 和 stdsoap2.h 文件这两个文件来自GSOAP工具目录中,也是我们需要的文件,在添加了 soapcpp2生成的文件外还需 要将这两个文件添加到我们工程的目录下。
展开阅读全文
相关资源
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!