WCF与Flex的通信

CTF逆向实战:如何快速识别RC4、TEA和Base64的魔改变种? 本文针对CTF逆向比赛中常见的加密算法魔改问题,详细讲解了如何快速识别和破解RC4、TEA和Base64的变种。通过分析算法核心特征、常见魔改手法,并结合动态调试与脚本编写等实战技巧,帮助逆向分析人员有效应对算法混淆,提升解题效率。 阅读详情

Tutorial: Talking to WCF with Flex 3 via JSON or XML

Here is a simple tutorial to show you how you can get WCF (hosted in ASP.NET) talking to Flex 3. I used Visual Studio 2008 Pro, IIS 7 and Flex Builder 3 (beta 3). I did my initial inspection of the data moving back and forth with Fiddler2 and Firebug.

 

Let start with the C# WCF code. First you will need to open Visual Studio 2008 and select "File -> New Website". Then pick "ASP.NET Website" and for the "location" select "HTTP" and point it to your local IIS. In my case I picked "http://localhost/HelloServices". Then hit the "Ok" button. Also, if your doing this in Windows Vista then you will need to start Visual Studio in Administrator mode (right-click on the Visual Studio 2008 icon and pick the "Run as Administrator" option from the menu).

Once the project has been created right-click on the new website from the Solution Explorer and select "Add New Item" and select "AJAX-enabled WCF Service". Call the new file "Greeting.svc". Delete out the "DoWork()" method from the generated code. Then add a namespace to the file and call it "HelloServices". Also make sure to fill in the namespace for the "ServiceContract" attribute with "HelloServices" as well. Now we will add a simple method:

C#:
using  System;
using  System. Linq;
using  System. Runtime. Serialization;
using  System. ServiceModel;
using  System. ServiceModel. Activation;
using  System. ServiceModel. Web;

 

namespace HelloServices
{

    [ServiceContract(Namespace = "HelloServices")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class Greeting
    {
        // Add [WebGet] attribute to use HTTP GET
        [OperationContract]
        public String SayHello(String name)
        {
            return "Hello: " + name;
        }

        // Add more operations here and mark them with [OperationContract]
    }
}

 

Lets go ahead and test this out with the Default.aspx file before we make the Flex project.

Move over to the "Default.aspx" file and go into design mode. From the toolbox select the "AJAX Extensions" and drag over the "Script Manager". Then from the "HTML" section drag over an "Input (Button)" and drop it on the page. Double click that new input button and it will generate some JavaScript for us. Next, click on the Script Manager that we dragged over already and go into it's properties. Select the "Services" property and you should get a button with "...". Click on that button to open up the "ServiceReference Collection Editor". Press the "Add" button and in the "Path" property enter "Greeting.svc". Lets add the JavaScript now, your page should look like this:

ASP:
<%@ Page Language= "C#" AutoEventWireup= "true"  CodeFile= "Default.aspx.cs" Inherits= "_Default"  %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
<script language="javascript" type="text/javascript">
// <!CDATA[

    function Button1_onclick()
    {
        var svc = new HelloServices.Greeting();
        svc.SayHello("Programmer", onSuccess, null, null);
    }

    function onSuccess(data)
    {
        alert(data);
    }

// ]]>
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Services>
                <asp:ServiceReference Path="Greeting.svc" />
            </Services>
        </asp:ScriptManager>
    
    </div>
    </form>
    <p>
        <input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></p>
</body>
</html>

 

Now a couple important things. Remember when we added the namespace "HelloServices". We now need to make sure the web.config file and the Greeting.svc file both reflect that. Your Greeting.svc file should look like this:

ASP:
<%@ ServiceHost Language= "C#" Debug= "true" Service= "HelloServices.Greeting" CodeBehind= "~/App_Code/Greeting.cs"  %>

 

The web.config section we are concerned about is the "system.serviceModel". Yours should look like this (its probably near the bottom of the web.config file):

XML:
<system.serviceModel>
         <behaviors>
             <endpointBehaviors>
                 <behavior name="GreetingAspNetAjaxBehavior">
                     <enableWebScript/>
                 </behavior>
             </endpointBehaviors>
         </behaviors>
         <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
         <services>
             <service name="HelloServices.Greeting">
                 <endpoint address="" behaviorConfiguration="GreetingAspNetAjaxBehavior" binding="webHttpBinding" contract="HelloServices.Greeting"/>
             </service>
         </services>
     </system.serviceModel>

 

Go ahead and run the project. When the Default.aspx page loads click on the button. You should see something like this:

wcf_result.jpg

Assuming that worked for you we can continue onto the Flex part of this tutorial. Open Flex Builder 3 and create a new "Flex Project" and call it "TalkToWCF". We won't add any GUI to this just to keep it simple. Make your MXML file looks like this:

XML:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="URLRequestExample();" layout="absolute">
    
     <mx:Script>
         <![CDATA[
            import flash.events.*;
            import flash.net.*;

 

            private function URLRequestExample():void
            {
                var loader:URLLoader = new URLLoader();
                var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
                
                configureListeners(loader);
    
                var request:URLRequest = new URLRequest("http://localhost/HelloServices/Greeting.svc/SayHello");
                request.method = URLRequestMethod.POST;
                request.requestHeaders.push(header);
                request.data = '{"name":"Programmer"}';
                
                try
                {
                    loader.load(request);
                    trace("Request sent");
                }
                catch (error:Error)
                {
                    trace("Unable to load requested document.");
                }
            }
    
            private function configureListeners(dispatcher:IEventDispatcher):void
            {
                dispatcher.addEventListener(Event.COMPLETE, completeHandler);
                dispatcher.addEventListener(Event.OPEN, openHandler);
                dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
                dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
                dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
            }
    
            private function completeHandler(event:Event):void
            {
                var loader:URLLoader = URLLoader(event.target);
                trace("completeHandler: " + loader.data);
            }
    
            private function openHandler(event:Event):void
            {
                trace("openHandler: " + event);
            }
    
            private function progressHandler(event:ProgressEvent):void
            {
                trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
            }
    
            private function securityErrorHandler(event:SecurityErrorEvent):void
            {
                trace("securityErrorHandler: " + event);
            }
    
            private function httpStatusHandler(event:HTTPStatusEvent):void
            {
                trace("httpStatusHandler: " + event);
            }
    
            private function ioErrorHandler(event:IOErrorEvent):void
            {
                trace("ioErrorHandler: " + event);
            }
        ]]>
    </mx:Script>
    
</mx:Application>

 

Run the Flex program in debug mode so you will see the trace statements since that is where the output is going. Hopefully you see this in the output:

flex_wcf.jpg

Down at the bottom is the JSON WCF returned to us - click on the image above if its too small to read.

Obviously a person can take this pretty far if you want to. The first thing would be to use the ActionScript CoreLib and parse the JSON coming back as well as encode the JSON you want to sent to WCF.

You can also have WCF send back XML rather than JSON. To do this you simply change your WCF method into this:

C#:
[OperationContract ]
         [WebInvoke (ResponseFormat = WebMessageFormat. Xml ) ]
         public  String SayHello ( String name )
         {
             return  "Hello: " + name;
         }

 

The result would be this:

XML:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Hello: Programmer </string>

绕过限制?实测修改UA在PC端运行微信小程序的可行性及风险 本文探讨了通过修改User-Agent(UA)在PC端运行微信小程序的技术可行性及风险。分析了小程序设备限制的技术原理,包括`wx.getSystemInfo`API和UA检测机制,并提供了多种修改方案及其局限性。同时强调了潜在的安全和法律风险,推荐使用官方模拟器或安卓模拟器等更安全的替代方案。 阅读详情

相关推荐

告别理论!手把手教你用Vivado 2020.2为ZYNQ PL端打造一个AXI4-Full读写DDR的IP核

本文详细介绍了如何使用Vivado 2020.2为ZYNQ PL端创建AXI4-Full主控IP核,实现高效读写DDR内存的实战指南。通过环境配置、IP核创建、系统集成到软件调试的全流程讲解,帮助开发者快速掌握AXI4-Full协议在ZYNQ平台上的应用,提升PL与PS协同工作的数据传输效率。

weixin_30300225的博客 467

FLEX 与 .net wcf /web services通信

http://www.cnblogs.com/yjmyzz/archive/2011/04/09/2010228.html此博文中记载了 Flex4中使用WCF的方法。但我更推荐http://www.fluorinefx.com/index.html这种方式,此软件在GUN协议下开源。  本文出自 “独钓寒江雪” 博客,请务必保留此出处http://zhaojie.blog.51cto.com

独钓寒江雪 690

Hive数据迁移

【迁移背景】 本次需要将老集群的hive数据(共30多张表)迁移至新集群中。 老集群版本为CDH5.13,未启用kerberos; 新集群版本为CDH5.14,启用了kerberos。 由于cloudera官方文档说明,在5.x的版本不支持从未启用kerberos的集群与启用了kerberos的集群之间的数据复制。因此无法通过bdr方式进行数据同步。于是采用手工方式进行测试验证。 第一步...

wangkuangood3200的专栏 470

8字轨迹模拟在运动控制中的实现与优化

运动控制是工业自动化中的核心技术,通过精确控制执行机构的运动轨迹来实现各种复杂任务。8字轨迹模拟作为经典测试案例,结合了直线、圆弧和速度方向变化等复合运动特征,能全面检验控制系统的动态性能。其核心原理基于两个相切圆的组合运动,在切点处产生加速度突变,这对控制算法提出了严峻挑战。在工程实践中,8字轨迹广泛应用于机器人路径规划、CNC机床测试和伺服电机评估等场景。通过参数化建模和运动控制算法(如PID+速度前馈)的结合,可以实现高精度轨迹跟踪。在STM32等嵌入式平台上,采用定时器中断和查表法能有效满足实时性要

weixin_34110749的博客 387

单细胞marker基因表达密度图-(还有一个包装函数)

我们借助Nebulosa,将上面的过程包装为一个函数,还是那句话,受累麻烦的事我们来解决,您轻松即可,先看看函数参数:需要注意的是,如果你只想框选某一类celltype,理想模式是这群celltype是单独聚类的,没有散落在其他类群,否则将会全部框选,效果不好,建议使用AI/PS添加。需要注意,这里我算是投机取巧了,用了一个和这个作图毫无关系的包ggnetwork,主要的目的是用他的theme_blank()主题,一次性将所有清空,当然也可以自己慢慢写,不过有现成的,为啥不用呢?这质感不就上去了嘛。

qq_42090739的博客 1373

GD32F103RCT6/GD32F303RCT6(6.2)USART串口实战:从寄存器配置到DMA高效传输

本文详细介绍了GD32F103RCT6和GD32F303RCT6的USART串口通信实战,从寄存器配置到DMA高效传输的全过程。通过具体的代码示例和优化建议,帮助开发者快速掌握串口通信的关键技术,提升嵌入式开发效率。特别强调了DMA在高速数据传输中的优势和应用技巧。

weixin_33725239的博客 309

Flex不支持SOAP1.2

Flex 3只支持SOAP1.1,不支持SOAP1.2:document Flex applications can interact with web services that define their interfaces in a Web Services Description Language 1.1 (WSDL 1.1) document, which ...

weixin_30510153的博客 81

ABAP_自定义屏幕07—下拉列表框

ABAP_自定义屏幕07—下拉列表框 完成以下:页面中有下拉列表框,下拉框value=系统表SCRR的值 1、实现方法A-常用 1.1 在主程序定义字段 TYPES:BEGIN OF type_carrid, carrid LIKE scarr-carrid,"航线代码 carrname LIKE scarr-carrname,"航向名称 END OF type_carrid. DATA g_it_carrid TYPE STANDARD TABLE OF type_carrid

f346348157的博客 3873

Flex 3 RIA 应用 + WCF 服务开发注意事项(2009-5-20 updated)

           这两天应需要研究了下 WCF 服务和 Flex 3 RIA 相关的开发技术,并上手写了一些代码,发现之前的考虑有不少细节问题需要注意、解决,打算用这篇持续更新的文章来做以记录,将通过 Flex 3 RIA 应用来使用 WCF 服务过程中发现的问题和解决方法以注意事项的形式记录清楚。正所谓吃一堑长一智,也请大家多多分享,一起补充。   WCF 服务使用的 SOAP 版本 ...

"#{thinking} on lzy" 248

C++实现复制粘贴文本功能

要实现这个功能,我们需要使用操作系统提供的函数来操作剪贴板。在Windows操作系统中,我们可以使用Windows API函数来访问剪贴板。总结起来,使用C++实现复制和粘贴文本功能涉及使用操作系统提供的API函数来操作剪贴板。在本篇文章中,我将向您展示如何使用C++编程语言实现复制和粘贴文本的功能。我们将使用操作系统提供的API来进行剪贴板操作,并编写相应的代码来完成这个任务。如果您使用的是Linux操作系统,您需要使用适当的库和函数来访问剪贴板。函数中,我们首先将一个字符串复制到剪贴板中,然后使用。

PixelDyno的博客 1233

老 Intel Mac mini 装 OpenClaw:低成本常年在线方案

老款Intel Mac mini部署OpenClaw方案摘要 本文详细介绍了如何利用老款Intel Mac mini低成本部署OpenClaw系统。方案推荐2011-2018款Mac mini,建议升级至16GB内存和SSD存储以提升性能。部署步骤包括:1)安装Ubuntu系统;2)配置Docker环境;3)通过docker-compose部署OpenClaw及其依赖组件(PostgreSQL和Redis);4)进行系统级和Docker层面的性能优化;5)设置开机自启动服务。该方案充分利用老款设备剩余价值,

一键难忘的博客 2479

使用FLEX的HttpService与ASP.NET进行动态交互之一

现在RIA技术可以说在互联网上是风风火火,adobe公司有FLEX,微软有银光。现在可以说是个有个的好处,不过做为互联网上最为风行的FLASH,我想它的支持率是大家有目共睹的,银光虽好,不过也得需要个一二年的成熟期哪。以前我在cnblogs上搜过是否有FLEX的文章,找到的比较少,记得好像是大部分都是采用了WEBSERVICE或者是WCF来实现的,关于HTTPService实现的方法就比较少了

老李 技术 专栏 984

24、水下传感器网络中混合LEACH协议与遗传算法获取路由节点

本文提出了一种结合遗传算法与LEACH协议的混合路由方案,用于提升水下无线传感器网络(UWSN)的能量利用效率和数据传输稳定性。通过遗传算法优化簇头选择与路径规划,有效避免节点过早死亡,减少能量消耗,在200个节点场景下显著提升网络寿命。相比传统LEACH协议,该方案具有更高的能量利用率、更强的环境适应性,并支持传输历史记录与并行传输序列。实验结果显示,该方案在总能量为2000焦耳时剩余能量达75.6%,远优于LEACH的34.8%能耗表现。适用于海洋监测、石油平台监控及水下灾害预警等复杂环境应用。

i8j9k0l1的博客 112

自己开发的Flex & .Net Remoting的框架

Rmoting技术已经出现了好几年,在应用上面也比较广,对开发网络程序带来很多的便利,大大提高了开发效率. .NET 框架下面的Remoting技术在3.0之后出现了WCF之后,支持了双向Remoting,在应用上面已经没有什么不足之处. 但是WCF的Remoting只在.NET FRAMEWORK之下使用灵活,对其它的客户端就....这个是MS留有一手吧. Remoting技术的...

140

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

使用FLEX的HttpService与ASP.NET进行动态交互之一(转载)

  使用FLEX的HttpService与ASP.NET进行动态交互之一(转载) 转自: http://www.cnblogs.com/chu888chu888/archive/2008/0 7/10/1239760.html   现在RIA技术可以说在互联网上是风风火火,adobe公司有FLEX,微软有银光。现在可以说是个有个的好处,不过做为互联网上最为风行的FLASH,我想它的支持率是...

idnyg86v 150

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

工作多年后才明白的.NET底层开发技术

参加工作已经有五年了。由于是非计算机科系,一开始的工作是做网页,维护ASP脚本程序,有时候也要做图片,总而言之,一项任务交到手里,没有借口说不会做,想办法弥补然后把任务做完。后来才得到机会,参与编程开发工作。而且,当时一心想用C#.NET做开发,不希望参与DELPHI的开发,偏偏工作经过层层的转发,交到手里的就是DELPHI开发。经历努力,再后来就真的用.NET进行开发工作,一直持续到现在。消极的...

weixin_30791095的博客 66

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

.NET底层开发技术

.NET领域里的底层技术.   1 通信技术(Remoting,WCF, ASMX)   通常的三层架构,数据库,数据访问层,界面层.通讯技术定义了三层组件之间的调用约定,以及方法.这样说起来有些抽象,举例为证.现在要制作一个进销存项目,基本的功能是进仓,出仓,转仓,查询功能要能查询到仓库进出日记帐,   库存余额.对于一笔物料为FLEX0901的进仓业务,用ORM的方...

weixin_33965305的博客 523
上一篇: Flex与JavaScript的交互
下一篇: ASP.NET Ajax调用WCF服务的代码示例
blacksource
博客等级 码龄21年 66粉丝 23原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值