ITPub博客

首页 > 应用开发 > IT综合 > 编写SOAP的ANSI C客户程序示例

编写SOAP的ANSI C客户程序示例

原创 IT综合 作者:liu1rui2 时间:2007-02-11 10:44:26 0 删除 编辑

1. 准备工作

1.1 下载、展开gSOAP


1.2 设置环境变量
set GSOAP=Z:gsoap-2.7


1.3 编译soapcpp2.obj
cd %GSOAP%soapcpp2
cl -c stdsoap2.c


2. 编译SOAP客户程序

2.1 从WSDL生成C头文件(包括预编译注释)
#例:
%GSOAP%soapcpp2wsdl2h -c -o quote.h xmethods-delayed-quotes.wsdl


2.2 编译框架文件
#例:
%GSOAP%soapcpp2soapcpp2 -c quote.h


2.3 编写客户程序
#例:
#include "soapH.h" // obtain the generated stub
#include "net_x002exmethods_x002eservices_x002estockquote_x002eStockQuoteBinding.nsmap" // obtain the generated XML namespace mapping table for the Quote service (soapcpp2生成的nsmap文件)

int main(){
struct soap *soap = soap_new();
float quote;

if (soap_call_ns1__getQuote(soap, NULL, NULL, "IBM", "e) == SOAP_OK)
printf("Current IBM Stock Quote = %gn", quote);
else // an error occurred
soap_print_fault(soap, stderr); // display the SOAP fault on the stderr stream

return 0;
}

2.4 编译客户程序
cl -o test.exe -I%GSOAP%soapcpp2 test.c soapC.c soapClient.c ..stdsoap2.obj

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8883925/viewspace-899150/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: Curriculum of KonKar
请登录后发表评论 登录
全部评论
  • 博文量
    2
  • 访问量
    4448