Consuming Hidden WCF RIA Services
原文 http://codeseekah.com/2013/07/05/consuming-hidden-wcf-ria-services/
A Silverlight application made it to my desk yesterday, an application that consumed a remote WCF RIA service running on a Microsoft IIS. The service did not provide a public API, nor did disassembly with dotPeek help get the service manifests to construct a WCF client with. WSDL files weren’t exposed either. A new, custom client was to be written by reverse engineering what was available without any fancy configurations.
A bit of Wiresharking around and the protocol details became exposed for some low-level replication. The payloads were encoded, and the Content-Type>
header hinted at application/msbin1
, which made it pretty clear that it was in .NET Binary Format. Decoding was simple by switching to Fiddler and a WCF Binary Inspector. Having retrieved the payloads sending binary to the private service was quite straight-forward in C#.
... using System.Xml;
using System.Net; ... /* Write .NET Binary XML */
System.IO.Stream s = new System.IO.MemoryStream();
XmlWriter binarywriter = XmlDictionaryWriter.CreateBinaryWriter(s); binarywriter.WriteStartElement("Action1", "http://tempuri.org/");
...
binarywriter.Flush(); s.Seek(0, System.IO.SeekOrigin.Begin);
byte[] b = new byte[s.Length];
s.Read(b, 0, (int)s.Length); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("hidden.svc/binary/Action1");
request.Method = "POST";
request.ContentType = "application/msbin1";
request.GetRequestStream().Write(b, 0, b.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); /* Read .NET XML */
b = new byte[response.ContentLength];
response.GetResponseStream().Read(b, 0, b.Length); XmlReader binaryreader = XmlDictionaryReader.CreateBinaryReader(b, XmlDictionaryReaderQuotas.Max);
XmlDocument xdoc = new XmlDocument();
xdoc.Load(binaryreader);
...
Needs the System
, System.Net
, System.Runtime.Serialization
and System.XML
assemblies.
To consume hidden WCF RIA services on other platforms check out xml2wcf.py
Consuming Hidden WCF RIA Services的更多相关文章
- Silverlight项目笔记2:.svc处理程序映射缺失导致的WCF RIA Services异常
在确定代码.编译结果和数据库都正常的情况下,无法从数据库取到数据.错误提示:Sysyem.Net.WebException:远程服务器返回了错误:NotFound,监听发现请求数据库的服务异常,访问相 ...
- Silverlight项目笔记1:UI控件与布局、MVVM、数据绑定、await/async、Linq查询、WCF RIA Services、序列化、委托与事件
最近从技术支持转到开发岗,做Silverlight部分的开发,用的Prism+MVVM,框架由同事搭好,目前做的主要是功能实现,用到了一些东西,侧重于如何使用,总结如下 1.UI控件与布局 常用的主要 ...
- Silverlight应用程序中调用WCF Ria Services访问数据库图片
WCF Ria Services(通常称为RIA服务),专门设计让Silverlight应用程序访问数据库,网上有关其示例应用都是基于简单的数据显示,其中MSDN网站上有详细的解决方案介绍,地址htt ...
- WCF RIA Services异常
.svc处理程序映射缺失导致的WCF RIA Services异常 在确定代码.编译结果和数据库都正常的情况下,无法从数据库取到数据.错误提示:Sysyem.Net.WebException:远程服务 ...
- WCF RIA Services使用详解(转载)
理解领域服务和领域操作 本文目录: 3.1 WCF Ria Services简介 3.1.1 什么是WCF Ria Services 3.1.2 WCF Ria Services如何生成客户端代码 3 ...
- 使用Entity Framework和WCF Ria Services开发SilverLight之6:查找指定字段
对数据库表指定字段的查找,又是实际工作中的一项必要工作.SL客户端仅获取实际需要的指定的字段,好处很多,比如:有助于减少网络流量. 有两类这样的使用场景. 1:联表查询不需要外键表 在上一篇中,我们使 ...
- Apache许可协议Open RIA Services
Jeff Handley's进行了多年的项目--基于一份开源许可发布WCF RIA Services.遵循Apache 2许可,捐赠给Outercurve基金会的ASP.NET Open Source ...
- 使用Fiddler解析WCF RIA Service传输的数据
原文 http://www.cnblogs.com/wintersun/archive/2011/01/05/1926386.html 使用Fiddler 2 解析WCF RIA Service传输的 ...
- WCF RIA SERVICE相关技术
WCF RIA SERVICE实体属性拷贝 private void DoSubmit() { ((IEditableObject)this.RepairContract).EndEdit(); va ...
随机推荐
- 自己配置的WAMP环境,扩展oracle函数库(oci)
同事昨天接到一个任务,要用php处理oracle数据库的内容,但是php打开oracle扩展不是像mysql那样直接用就行,需要下一点东西才能打开 第一步 需要到oracle官方下载一个install ...
- 关于wireshark的两个抓包过滤显示的基本语法
关于wireshark的两个基本语法 关于wireshark的两个基本语法 1. Capture Filters 语法:<Protocol name><Direction>&l ...
- 关于表格动态添加行并处理相关表单元素的一些修改----优化for重用(2)
功能介绍: 1.处理了动态行与表单的设值问题 2.添加了行的向上或向下排序 3.添加了可以在当前行的下边或上边增加新行的功能 4.添加了可以单选或勾选多项删除不需要的行的功能 5.添加了新增的行的高亮 ...
- Html内容超出标记宽度后自动隐藏
我们在显示长文本时,往往需要去在C#端去截取字符,但这绝对不是一个好方面,因为我们的长文本往往都是代HTML标记的,你一个载不好,就会出现乱码问题(出现半个HTML标记),而比较好的作法就是通过CSS ...
- python Memo
list&tuple 运算 乘以constant >>> x = ((1,2),) >>> x*2 ((1, 2), (1, 2)) >>> ...
- SQL Server 一些重要视图4
sys.master_files 为每一个数据库的每一个文件返回行.
- 蓝牙1.1、蓝牙1.2、蓝牙2.0(蓝牙2.0+EDR)区别
蓝牙1.2版本相对于1.1版本: 1.Adaptive Frequency Hopping(AFH):即所谓适应性跳频技术,主要的功能是用来减少蓝牙产品与其它无线通讯装置之间所产生的干扰问题 2.Ex ...
- Android 屏幕适配方式
适配:即当前应用在相同的手机上面显示相同的效果.适配前需要首先确定当前手机所属像素密度类型(如:xhdpi.hdpi.mdpi等) 像素密度:每英寸上分布的像素点个数,单位(dpi,ppi),利用勾股 ...
- GDKOI2015 Day2
P1 题目描述: 给出一个二分图,选择互不相交的边,使得边覆盖的点权和最大. solution: 简单DP,用树状数组维护最大值. 时间复杂度:$O(n \log n) $ P2 题目描述: 给出N个 ...
- poj1658
#include <stdio.h> #include <stdlib.h> int main() { int n; scanf("%d",&n); ...