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. fastreport 如何 设置 richview 的 行高

    richview中的行高改变有点特别.必须在AfterData 事件执行的时候才能修改: 也就是说,如果简单的放一个按钮,去发送消息给richView->RichEdit ,然后调用frxRep ...

  2. pt-query-digest查询日志分析工具

    1.工具介绍 pt-query-digest是用于分析mysql慢查询的一个工具,它可以分析binlog.General log.slowlog,也可以通过SHOWPROCESSLIST或者通过tcp ...

  3. 【转载】OpenGL ES 三种类型修饰 uniform attribute varying

    其实attribute varying已经被in和out代替了,但是有些工程代码里面仍然还在,所以权当笔记好了. 1.uniform变量uniform变量是外部application程序传递给(ver ...

  4. information_schema系列四(跟踪,列约束,表和列)

    这个系列的文章主要是为了能够让自己了解MySQL5.7的一些系统表,统一做一下备注和使用,也希望分享出来让大家能够有一点点的受益. 1:KEY_COLUMN_USAGE 按照官方的解释,这个表描述的是 ...

  5. javascript-test1

    var AAA = function(name, age) { this.name = name ; this.age = age; } AAA.prototype.getName = functio ...

  6. svn 命令行创建和删除 分支和tags

    创建分支 svn cp -m "create branch" http://svn_server/xxx_repository/trunk http://svn_server/xx ...

  7. scala学习心得(2)

    scala类中可以通过override 重载方法 scala定义的函数式类不可被改变,这样传进去的参数就需要提前被检验,可以通过scala.predef包中的方法require方法 定义辅助构造器 d ...

  8. SQL SERVER连接、合并查询

    ----创建测试表MyStudentInfoCREATE table MyStudentInfo(  Id int not null primary key,  Name varchar(16),  ...

  9. sql中 查询条件出现单引号和特殊字符处理

    1.两个单引号转为一个单引号 example:  select * from tb where  name=' '' ' 2.如果出现 "_","%"  需要用 ...

  10. jQuery Mobile 过渡效果

    jQuery Mobile 包含了允许您选择页面打开方式的 CSS 效果. jQuery Mobile 过渡效果 jQuery Mobile 拥有一系列关于如何从一页过渡到下一页的效果. 注释:如需实 ...