c、c++与webservice

c、c++与webservice

ID:4158857

大小:712.47 KB

页数:8页

时间:2017-11-29

c、c++与webservice_第1页
c、c++与webservice_第2页
c、c++与webservice_第3页
c、c++与webservice_第4页
c、c++与webservice_第5页
资源描述:

《c、c++与webservice》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、C/C++与WEBSERVICEStart:2011.03.06Updated:2011.03.08王凡(wangfan)wf141732@sohu.comwoshiwangfan@gmail.comhttp://t.qq.com/lingmengfei版本修改日期内容1.02011.03.08创建1.简介1.1.环境信息Gsoap:2.81.2.相关文档《LinuxCGI》2.软件准备2.1.Gsoap2下载地址:http://downloads.sourceforge.net/project/gsoap2/gSOAP/gsoap_

2、2.8.1.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgsoap2%2Fdevelop&ts=1299399273&use_mirror=nchc下载后执行标准的配置编译cdgsoap2./configure./make./makeinstall2.2.服务器准备参照《LinuxCGI》3.一个简单的例子做一个获取当前时间的例子3.1.服务端新增文件currentTime.h//File:currentTime.h//gsoapnsservicename:currentTime//

3、gsoapnsservicenamespace:urn:currentTime//gsoapnsservicelocation:http://192.168.115.129:89/ws/currentTime.cgiintns__currentTime(time_t&response);在上面注释的部分都是丌可或缺的,其中双下划线是由于和java通信的标准只能采用Document/literal格式的标准。另外location是到时候传输给服务器的接口部分。在soap2目录/home/wangfan/gsoap2/gsoap/bin/

4、linux386下面拷贝soapcpp2到建立的add.h目录下面,然后编译add文件./soapcpp2currentTime.h编译完成后会在当前目录下面生成很多文件2再来构建服务器代码,即处理逻辑部分//File:currentTime.cpp#include"soapH.h"//includethegenerateddeclarations#include"currentTime.nsmap"//includetheXMLnamespacemappingsintmain(){//createsoapcontextandserv

5、eoneCGI-basedrequest:returnsoapserve(soapnew());}intnscurrentTime(structsoap*soap,timet&response){response=time(0);returnSOAPOK;}然后编译成cgisoapcpp2-ScurrentTime.hc++-ocurrentTime.cgicurrentTime.cppsoapC.cppsoapServer.cppstdsoap2.cpp3.2.Jdeveloper调用使用jdeveloper来生成客户端345调用的

6、代码写在client文件中6packagecurrenttime;importcom.bea.staxb.types.XMLGregorianCalendar;importjava.util.GregorianCalendar;importjavax.xml.ws.WebServiceRef;//!THECHANGESMADETOTHISFILEWILLBEDESTROYEDIFREGENERATED!//ThissourcefileisgeneratedbyOracletools//Contentsmaybesubjecttocha

7、nge//Forreportingproblems,usethefollowing//Version=OracleWebServices(11.1.1.0.0,build101221.1153.15811)publicclassCurrentTimeClient{@WebServiceRefprivatestaticCurrentTime_ServicecurrentTime_Service;publicstaticvoidmain(String[]args){currentTime_Service=newCurrentTime_Se

8、rvice();CurrentTimePortTypecurrentTimePortType=currentTime_Service.getCurrentTime();System.out.println(current

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。