webservice 开发 axis2 简单部署服务 gSoap 客户端通信
2013-02-18 20:08
615 查看
WebService 的服务端
webservice 开发 axis2 简单部署服务 就是用前一章中的服务端
wsdl如下:
http://localhost:8080/axis2/services/SimpleService?wsdl
下载 gsoap 2.8 版本
第一步生成头文件:
wsdl2h –o hello.h -s http://localhost:8080/axis2/services/SimpleService?wsdl
参数说明 -s 不要使用STL代码
第二步 根据头文件生成stub
soapcpp2.exe -i -C -x hello.h -IF:\gsoap-2.8\gsoap\import
参数说明 -i 直接使用C++包装类 -x 不要生成一堆看了就恶心的xml -C 只生成客户端相关代码 -I 指定import路径
第三步 VS2008 创建 命令行工程 ws5
第四步 编辑工程属性 C/C++ -> 预编译头 -> 创建/使用预编译头 选择 不使用预编译头
第五步 编辑工程属性 链接器->输入->附件依赖项 输入 WSock32.Lib
第六步 把刚才gsoap生成的文件 soapH.h soapC.c soapStub.h soapClient.c
和gsoap文件夹下的 stdsoap2.h stdsoap2.c 拷贝到当前工程下面
第七步 实现
C代码
#include "stdafx.h"
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include "soapH.h"
#include "SimpleServiceSoap11Binding.nsmap"
int _tmain(int argc, _TCHAR* argv[])
{
struct soap *soap = soap_new();
struct _ns1__getGreetingResponse out;
soap->mode|=SOAP_C_MBSTRING;
soap_set_mode(soap,SOAP_C_MBSTRING);
setlocale(0,"chs");
struct _ns1__getGreeting resq;
resq.name="超人";
if(soap_call___ns1__getGreeting(soap,NULL,NULL,&resq,&out)==SOAP_OK){
printf("%s\n",out.return_);
}
printf("Press enter to continue ...");
getchar();
return 0;
}
输出结果:
你好 超人
webservice 开发 axis2 简单部署服务 就是用前一章中的服务端
wsdl如下:
http://localhost:8080/axis2/services/SimpleService?wsdl
下载 gsoap 2.8 版本
第一步生成头文件:
wsdl2h –o hello.h -s http://localhost:8080/axis2/services/SimpleService?wsdl
参数说明 -s 不要使用STL代码
第二步 根据头文件生成stub
soapcpp2.exe -i -C -x hello.h -IF:\gsoap-2.8\gsoap\import
参数说明 -i 直接使用C++包装类 -x 不要生成一堆看了就恶心的xml -C 只生成客户端相关代码 -I 指定import路径
第三步 VS2008 创建 命令行工程 ws5
第四步 编辑工程属性 C/C++ -> 预编译头 -> 创建/使用预编译头 选择 不使用预编译头
第五步 编辑工程属性 链接器->输入->附件依赖项 输入 WSock32.Lib
第六步 把刚才gsoap生成的文件 soapH.h soapC.c soapStub.h soapClient.c
和gsoap文件夹下的 stdsoap2.h stdsoap2.c 拷贝到当前工程下面
第七步 实现
C代码
#include "stdafx.h"
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include "soapH.h"
#include "SimpleServiceSoap11Binding.nsmap"
int _tmain(int argc, _TCHAR* argv[])
{
struct soap *soap = soap_new();
struct _ns1__getGreetingResponse out;
soap->mode|=SOAP_C_MBSTRING;
soap_set_mode(soap,SOAP_C_MBSTRING);
setlocale(0,"chs");
struct _ns1__getGreeting resq;
resq.name="超人";
if(soap_call___ns1__getGreeting(soap,NULL,NULL,&resq,&out)==SOAP_OK){
printf("%s\n",out.return_);
}
printf("Press enter to continue ...");
getchar();
return 0;
}
#include "stdafx.h" #include <locale.h> #include <stdio.h> #include <stdlib.h> #include "soapH.h" #include "SimpleServiceSoap11Binding.nsmap" int _tmain(int argc, _TCHAR* argv[]) { struct soap *soap = soap_new(); struct _ns1__getGreetingResponse out; soap->mode|=SOAP_C_MBSTRING; soap_set_mode(soap,SOAP_C_MBSTRING); setlocale(0,"chs"); struct _ns1__getGreeting resq; resq.name="超人"; if(soap_call___ns1__getGreeting(soap,NULL,NULL,&resq,&out)==SOAP_OK){ printf("%s\n",out.return_); } printf("Press enter to continue ..."); getchar(); return 0; }
输出结果:
你好 超人
相关文章推荐
- webservice 开发 axis2 简单部署服务 gSoap 客户端通信
- webservice 开发 axis2 简单部署服务
- webservice 开发 axis2 简单部署服务
- 通过 Axis2 开发 Web 服务,第 1 部分: 通过 Axis2 运行时部署和使用简单 Web 服务
- 基于Axis2的web服务的开发、部署和客户端调用
- 通过 Axis2 开发 Web 服务,第 1 部分: 通过 Axis2 运行时部署和使用简单 Web 服务
- 基于Axis2的web服务的开发、部署和客户端调用
- 通过 Axis2 开发 Web 服务,第 1 部分: 通过 Axis2 运行时部署和使用简单 Web 服务
- 通过 Axis2 开发 Web 服务,第 1 部分: 通过 Axis2 运行时部署和使用简单 Web 服务
- gSoap入门之三__C++开发的简单WebService客户端程序
- 通过 Axis2 开发 Web 服务,第 1 部分: 通过 Axis2 运行时部署和使用简单 Web 服务
- Axis2开发WebService客户端 的3种方式
- Axis2开发WebService客户端 的3种方式(转载)
- 使用axis2创建webservice步骤以及客户端调用service服务代码
- 基于Axis2开发WebService-客户端
- WebService服务及客户端调用简单实例
- axis2c 做的客户端程序接收基于Axis2 java的Webservice服务返回的超长字符串
- axis2客户端调用免费的webservice服务的实例之一通过wsdl生成客户端程序并本地调用
- WebService客户端开发(Axis2 1.5)
- 教程:如何用Axis2开发和部署Web服务