理解 Soap
http://www.cnblogs.com/yhuang/archive/2012/04/04/share_storm.html
自己也写了下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyCmn;
using System.Web;
using System.Net;
using System.IO; namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var str = @"<?xml version=""1.0"" encoding=""utf-8""?>
<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<soap:Body>
<Login xmlns=""MyServer"">
<RequestJson>{WebName:""iudi"",Password:""iudi""}</RequestJson>
</Login>
</soap:Body>
</soap:Envelope>"; HttpWebRequest request = HttpWebRequest.Create("http://udi-pc/WcfService/AndroidApp.svc") as HttpWebRequest;
request.Method = "POST";
request.Headers["SoapAction"] = "MyServer/AndroidApp/Login";
request.ContentType = "text/xml; charset=utf-8";
request.Pipelined = true;
request.AllowAutoRedirect = true;
request.KeepAlive = true;
request.Headers["UseCookieContaner"] = "True"; var rs = request.GetRequestStream(); var ary1 = System.Text.Encoding.UTF8.GetBytes(str);
rs.Write(ary1, , ary1.Length); var resp = request.GetResponse() as HttpWebResponse; using (var respStream = resp.GetResponseStream())
{
System.IO.BinaryReader reader = new BinaryReader(respStream);
byte[] ary = null;
if (resp.ContentLength <= )
{
var listAry = new List<byte>(); while (true)
{
var tempAry = reader.ReadBytes();
if (tempAry.Length == ) break;
listAry.AddRange(tempAry);
} ary = listAry.ToArray();
}
else
{
ary = reader.ReadBytes(resp.ContentLength.AsInt());
} var html = "";
if (resp.CharacterSet.HasValue())
{
html = System.Text.Encoding.GetEncoding(resp.CharacterSet).GetString(ary);
}
else
{
html = System.Text.Encoding.Default.GetString(ary);
} Console.WriteLine(html);
} }
}
}
理解 Soap的更多相关文章
- WCF 出现无法理解Soap Action问题?
在使用wcf部署到asp.net上时,遇到了,“无法理解soap Action 问题,”最简单的解决办法是更换NET framwork 高本版的框架. 不过不更换net framwork 框架,能否解 ...
- php中soap的使用实例以及生成WSDL文件,提供自动生成WSDL文件的类库——SoapDiscovery.class.php类
1. web service普及: Webservice soap wsdl区别之个人见解 Web Service实现业务诉求: Web Service是真正“办事”的那个,提供一种办事接口的统称. ...
- php学习之道:php中soap的使用实例以及生成WSDL文件,提供自己主动生成WSDL文件的类库——SoapDiscovery.class.php类
1. web service普及: Webservice soap wsdl差别之个人见解 Web Service实现业务诉求: Web Service是真正"办事"的那个,提供 ...
- Webservice soap wsdl区别之个人见解
原文:http://blog.csdn.net/pautcher_0/article/details/6798351 Web Service实现业务诉求:Web Service是真正“办事”的那个,提 ...
- SOAP协议初级指南 (一)
SOAP(Simple Object Access Protocal) 技术有助于实现大量异构程序和平台之间的互操作性,从而使存在的应用能够被广泛的用户所访问.SOAP是把成熟的基于HTTP的WEB技 ...
- 浅谈 SOAP
http://www.ibm.com/developerworks/cn/xml/x-sisoap/ 本文对 SOAP 作了一个初步介绍,给出几个简单示例:接着比较 CORBA,DCOM/COM 与 ...
- 使用JQuery的Ajax调用SOAP-XML Web Services(Call SOAP-XML Web Services With jQuery Ajax)(译+摘录)
假设有一个基于.Net的Web Service,其名称为SaveProduct POST /ProductService.asmx HTTP/1.1 Host: localhost Content-T ...
- 06_WebService与Socket的区别
[区别] 区别1. Socket是基于TCP/IP的传输层协议. WebService是基于HTTP协议传输数据的,HTTP是基于TCP的应用层协议. 区别2. WebService采用了基于HTTP ...
- WebService学习笔记系列(二)
soap(简单对象访问协议),它是在http基础之上传递xml格式数据的协议.soap协议分为两个版本,soap1.1和soap1.2. 在学习webservice时我们有一个必备工具叫做tcpmon ...
随机推荐
- Oracle 查询类似 select top 的用法
--查询前10条数据select * from MID_EHR_STAFF where rownum<10;--查询第5~10条的记录,minus(减)select * from MID_EHR ...
- MySQL5.7.10免安装版配置
最新版的 Mysql 不提供图形界面的安装了, 下载下来是一个压缩包的形式, 那么我们如何来使用它呢, 让它为我们工作呢? 环境: mysql-5.7.10-winx64 + win7(64位) 一 ...
- WinExec
WinAPI: WinExec - 运行外部程序 //声明 WinExec( lpCmdLine: LPCSTR; {文件名和参数; 如没指定路径会按以下顺序查找: 程序目录/当前目录/Syste ...
- rotate the clock
A program test: You are given N round clocks. Every clock has M hands, and these hands can point to ...
- Java NIO教程 Selector
这次我们开讲非阻塞I/O中的Selector,它需要配合非阻塞的TCP和UDP来使用.首先我们先简单讲一下TCP和UDP的非阻塞通道. 非阻塞I/O通道 在上代码前我们先讲解一些最基本的知识.TCP和 ...
- URLConnection 和 HttpClients 发送请求范例
. java.net.URLConnection package test; import java.io.BufferedReader; import java.io.IOException; im ...
- 【iOS问题】The file “XXX.app” couldn’t be opened because you don’t have permission to view it.
当引入第三方的框架的时候 容易产生以下问题: The file "XXX.app" couldn't be opened because you don't have permis ...
- C#使用NPOI导出Excel表格
using NPOI.HSSF.UserModel;using NPOI.SS.UserModel; /// <summary> /// DataTable导出Excel /// < ...
- Spring MVC Web框架
1. Spring MVC简介 Spring MVC是java EE平台请求驱动类型的轻量级Web框架,使用了MVC设计模式的思想,spring框架的主要优势之一就是分层架构,分层架构允许选择使用 ...
- linux桌面环境gnome,kde,xfce,lxde 使用比较(转)
Linus Torvalds大神前几日在 Google+上表示,GNOME 3"无可容忍的凌乱",改投Xfce桌面环境.下面就GNOME, KDE, XFCE和 LXDE略作比较. ...