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. Windows程序设计(第五版)学习:第三章 窗口与消息

        第三章 窗口与消息 1,windows窗口过程:应用程序所创建的每一个窗口都有一个与之关联的窗口过程,用于处理传递给窗口的消息. 2,窗口依据窗口类来创建.窗口类标识了用于处理传递给窗口的消息 ...

  2. Windows的拖放操作使用方法

    Windows的拖放操作使用方法

  3. Android_ADB 常用 shell命令 和 sqlite3 简单增删改查

    今天学习了一个ADB的常用命令.接下来简单使用几个常用ADB shell 命令. 首先我们得明白什么是adb.exe ADB -Android Debug Bridge, 是 Android sdk ...

  4. PHP基本问题

    WampServer修改端口及菜单Localhost http://www.wuwenhui.cn/3047.html WAMPServer默认配置更改-web根目录 http://blog.csdn ...

  5. css3的一些新属性1

    <body> /*文本阴影*/ <h1 style="text-shaow:5px 5px 5px #C0F">我爱你</h1> </bo ...

  6. [原创]PCB知识补充

    近期又要使用Altium进行PCB板的绘制,算起来从大学课上第一次接触Protel99SE到现在已经算是半个熟练工了.不过现在想来还是能回忆起第一次使用的情景,对着一幅简单的原理图使用着自动连线的功能 ...

  7. SQL Server 存储过程自定义生成ID号

    * FROM sys.tables WHERE name=N'EmployeeNo_Identity') DROP TABLE EmployeeNo_Identity GO CREATE TABLE ...

  8. 返回绝对值--Math.Abs 方法

    Math.abs()  返回指定数字的绝对值.

  9. OA项目之导出

    要导出页的前台: <asp:Button runat="server" ID="btnExport" Text="导出" CssCla ...

  10. [转载] 散列表(Hash Table) 从理论到实用(下)

    转载自: 白话算法(6) 散列表(Hash Table) 从理论到实用(下) [澈丹,我想要个钻戒.][小北,等等吧,等我再修行两年,你把我烧了,舍利子比钻戒值钱.] ——自扯自蛋 无论开发一个程序还 ...