QtSoap开发web services客户端程序
void getResponse();
QTextEdit *m_pWeatherEdt;
QtSoapHttpTransport http;
{
QtSoapMessage request;
request.setMethod("getPopulation", "http://www.abundanttech.com/WebServices/Population");
request.addMethodArgument("strCountry", "", "china");
http.submitRequest(request, "/WebServices/Population/population.asmx");
如下:
SOAP
The following is a sample SOAP request and response. The placeholders shown need to be replaced with actual values.
POST /WebServices/Population/population.asmx HTTP/1.1
Host: www.abundanttech.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.abundanttech.com/WebServices/Population/getPopulation" string
{
QtSoapMessage request;
request.setMethod("getSupportProvince", "http://tempuri.org/");
http.submitRequest(request, "/Service.asmx");
SOAP 1.1
以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。
POST /Service.asmx HTTP/1.1
Host: www.ayandy.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/getSupportProvince"
{
if (message.isFault())
{
m_pWeatherEdt->append(message.faultString().value().toString().toLatin1().constData());
}
else
{
// Get the return value, and print the result.
const QtSoapType &response = message.returnValue();
m_pWeatherEdt->append(response["Country"].value().toString().toLatin1().constData());
m_pWeatherEdt->append(response["Pop"].value().toString().toLatin1().constData());
m_pWeatherEdt->append(response["Date"].value().toString().toLatin1().constData());
}
}
以上方法只能解析固定类型的消息,下面介绍一种通用方法:
{
const QtSoapMessage &message = http.getResponse();
if (message.isFault())
{
m_pWeatherEdt->append(message.faultString().value().toString().toLatin1().constData());
}
else
{
const QtSoapType &root = message.returnValue();
QtSoapStruct myStruct((QtSoapStruct&)root);
for (int i = 0; i < myStruct.count(); i++)
{
m_pWeatherEdt->append(myStruct[i].typeName() + " : " + myStruct[i].toString());
}
}
QtSoap开发web services客户端程序的更多相关文章
- Qt 开发WEB Services客户端代码(使用gSoap)
1. 首先下载gSoap开发包 http://sourceforge.net/projects/gsoap2 目录包含 wsdl2h.exe( 由wsdl生成接口头文件C/C++格式的头文件 ) ...
- 在 IBM RAD 平台上基于 JAX-WS 开发 Web Services服务器端,客户端
原文地址:https://www.ibm.com/developerworks/cn/websphere/library/techarticles/1305_jiangpl_rad/1305_jian ...
- web调用客户端程序
背景 最近做一个集成需求,我们是B/S架构的,对方是C/S架构的,对方直接扔过来一个EXE连OCX都没有,让我们调用,也就是说,我们需要通过js程序去调用他们的客户端程序并传入多个参数,当时内心是崩溃 ...
- 开发 web 桌面类程序几个必须关注的细节
HoorayOS 写了差不多快2年了,在我的坚持下也有一部分人打算着手自己也写套类似的程序,我想我可以提供一点经验. 俗话说细节决定成败,开发2年多来,我看过大大小小类似的程序不下20个,各有优点也各 ...
- 跟我一起学WCF(3)——利用Web Services开发分布式应用
一.引言 在前面文章中分别介绍了MSMQ和.NET Remoting技术,今天继续分享.NET 平台下另一种分布式技术——Web Services 二.Web Services 详细介绍 2.1 We ...
- 利用Web Services开发分布式应用
一.引言 在前面文章中分别介绍了MSMQ和.NET Remoting技术,今天继续分享.NET 平台下另一种分布式技术——Web Services 二.Web Services 详细介绍 2.1 We ...
- 利用WSCF进行契约先行的Web Services开发
http://www.cnblogs.com/goody9807/archive/2007/06/05/772107.html 什么是契约先行(Contract-First)? 如果说一个新的软件开发 ...
- Delphi 6 Web Services初步评估之三(转)
Delphi 6 Web Services初步评估之三(转) Delphi 6 Web Services初步评估之三(转)★ 测试总体印象:在整个测试中,对Delphi 6创建的Web Servi ...
- 使用 python 开发 Web Service
使用 python 开发 Web Service Python 是一种强大的面向对象脚本语言,用 python 开发应用程序往往十分快捷,非常适用于开发时间要求苛刻的原型产品.使用 python 开发 ...
随机推荐
- 管理node_modules
http://stackoverflow.com/questions/15225865/centralise-node-modules-in-project-with-subproject
- mac使用小技
xcodeブラックスクリーンの解決策: 1.cd ~/Library/Developer/Xcode/DerivedData 2.rm -fr * //注释:-fr和*是分开的3.关闭模拟器,关 ...
- JavaScript 你好!
JavaScript简介 开发时间:1995年 开发目的:一开始的目的是处理以前由服务器端语言(如perl)负责的一些输入验证操作. 现状:现在的用途不再局限于简单的数据验证,而是具备了与浏览器窗口及 ...
- codeforces 659D . Bicycle Race 几何
题目链接 对相邻的三个点叉积判断一下就好. #include <iostream> #include <vector> #include <cstdio> #inc ...
- cad画指定大小矩形
指定基点后输入(@长度,宽度)回车 举例:如你要画个600*300的矩形 则输入@600,300回车
- XP下Virtualbox虚拟Ubuntu共享文件夹设置
环境:主机操作系统是Windows XP,虚拟机是Ubuntu 8.10,虚拟机是VirtualBox 2.1.0. 1. 安装增强功能包(Guest Additions) 安装好Ubuntu 8.1 ...
- SLC和MLC闪存芯片的区别
许多人对闪存的SLC和MLC区分不清.就拿目前热销的MP3随身听来说,是买SLC还是MLC闪存芯片的呢?在这里先告诉大家,如果你对容量要求不高,但是对机器质量.数据的安全性.机器寿命等方面要求较高,那 ...
- DbConnectionFactory 数据库连接
/** * */package com.sprucetec.dbatch.tmsfee;import java.io.Serializable;import java.sql.Connection;i ...
- mysql binlog 混合模式 出现的基于sql的数据不一致,主要是now()这类函数导致
- Strange Towers of Hanoi
题目链接:http://sfxb.openjudge.cn/dongtaiguihua/E/ 题目描述:4个柱子的汉诺塔,求盘子个数n从1到12时,从A移到D所需的最大次数.限制条件和三个柱子的汉诺塔 ...