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的更多相关文章

  1. WCF 出现无法理解Soap Action问题?

    在使用wcf部署到asp.net上时,遇到了,“无法理解soap Action 问题,”最简单的解决办法是更换NET framwork 高本版的框架. 不过不更换net framwork 框架,能否解 ...

  2. php中soap的使用实例以及生成WSDL文件,提供自动生成WSDL文件的类库——SoapDiscovery.class.php类

    1. web service普及: Webservice soap wsdl区别之个人见解 Web Service实现业务诉求:  Web Service是真正“办事”的那个,提供一种办事接口的统称. ...

  3. php学习之道:php中soap的使用实例以及生成WSDL文件,提供自己主动生成WSDL文件的类库——SoapDiscovery.class.php类

    1. web service普及: Webservice soap wsdl差别之个人见解 Web Service实现业务诉求:  Web Service是真正"办事"的那个,提供 ...

  4. Webservice soap wsdl区别之个人见解

    原文:http://blog.csdn.net/pautcher_0/article/details/6798351 Web Service实现业务诉求:Web Service是真正“办事”的那个,提 ...

  5. SOAP协议初级指南 (一)

    SOAP(Simple Object Access Protocal) 技术有助于实现大量异构程序和平台之间的互操作性,从而使存在的应用能够被广泛的用户所访问.SOAP是把成熟的基于HTTP的WEB技 ...

  6. 浅谈 SOAP

    http://www.ibm.com/developerworks/cn/xml/x-sisoap/ 本文对 SOAP 作了一个初步介绍,给出几个简单示例:接着比较 CORBA,DCOM/COM 与 ...

  7. 使用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 ...

  8. 06_WebService与Socket的区别

    [区别] 区别1. Socket是基于TCP/IP的传输层协议. WebService是基于HTTP协议传输数据的,HTTP是基于TCP的应用层协议. 区别2. WebService采用了基于HTTP ...

  9. WebService学习笔记系列(二)

    soap(简单对象访问协议),它是在http基础之上传递xml格式数据的协议.soap协议分为两个版本,soap1.1和soap1.2. 在学习webservice时我们有一个必备工具叫做tcpmon ...

随机推荐

  1. MySQL把多个字段合并成一条记录的方法

    转:http://www.111cn.net/database/mysql/71591.htm MySQL把多个字段合并成一条记录的方法 在mysql中字段合并可以使用很多函数来实现,如可以利用 GR ...

  2. MySQL_杭州11月销售昨日未上架的SKU_20161212

    #C034杭州11月销售昨日未上架的SKU SELECT 城市,a.订单日期,a.客户数,a.订单数,b.产品数,a.金额,c.销售确认额,c.毛利额,c.毛利率 FROM ( SELECT 城市,订 ...

  3. ecshop的弊病和需要修改的地方,持续更新

    ecshop的session机制是基于cookie的,用数据库进行缓存,当浏览器关闭cookie,sessions表会爆表,所以需要改进. 在cls_template.php中 $_echash值是固 ...

  4. jsoncpp操作 json

    jsoncpp操作 json 博客分类: c/c++ object-c 之 iphone   #include <iostream> //#include "json/json. ...

  5. ado.net access oracle dataset via store procedure

    使用存储过程返回结果集,并绑定到ado.net对象中在sql server里面是非常直观的. 1: create procedure GetAllRecords 2: as 3: select * f ...

  6. 关于Oracle的性能调整(一)

    Oracle Tuning的一些总结 关于Oracle的性能调整,一般包括两个方面,一是指Oracle数据库本身的调整,比如SGA.PGA的优化设置,二是连接Oracle的应用程序以及SQL语句的优化 ...

  7. poj 2446 Chessboard (二分匹配)

    Chessboard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 12800   Accepted: 4000 Descr ...

  8. js 验证码 倒计时60秒

    js 验证码 倒计时60秒 <input type="button" id="btn" value="免费获取验证码" /> & ...

  9. Python全栈之路6--正则表达式

    正则本身就是一门语言: 正则表达式使用单个字符串来描述.匹配一系列符合某个句法规则的字符串,在文本处理方面功能非常强大,也经常用作爬虫,来爬取特定内容,Python本身不支持正则,但是通过导入re模块 ...

  10. ABP的事件总线和领域事件(EventBus & Domain Events)

    http://www.aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events EventBus EventBus是个单例,获得Even ...