Flex and. NET Interop (VII)

Source: Internet
Author: User
Tags web services client

Flex vs. NET Interop (vii): Understanding FLUORINEFX Environment Configuration (remote objects, gateways, channels, destinations)

Note: This article was originally planned in the previous "flex and. NET Interoperability (VI): Flex and. NET Collaborative development tool FluorineFX", taking into account that the content of the article is too long to be divided into two articles.

Remote object access in Flex, where the server provides a remote service object (Remotingservice object), the process by which the flex client invokes the remote object through the appropriate access technology.

The approach to accessing webservice, described in previous articles in this series, is a remote object approach, except that he is remote access based on Web services (Webservie), not remote access based on remote objects (Remoting object). In order to achieve direct object-based remote access is cumbersome, and then FluorineFX specifically for us to provide this functionality, through the FLUORINEFX Core library to develop remote objects (Remoting object) services, how to achieve the specific? FluorineFX requires the [Remotingservice] tag to provide remote Object Services for remote objects, and look at the detailed definition of the following remotingserviceattribute:

1 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
2 public sealed class RemotingServiceAttribute : Attribute
3 {
4 public RemotingServiceAttribute();
5 public RemotingServiceAttribute(string serviceName);
6 }

As you can see from the example code in the previous article, use the. NET (C #) defines a remote object service class for sample and assigns it [Remotingservice], as detailed below:

1 [RemotingService("Fluorine sample service")]
2 public class Sample
3 {
4 public Sample()
5 {
6 }
7
8 public string Echo(string text)
9 {
10 return "Gateway echo: " + text;
11 }
12 }

The example of a remote object that flex client calls FluorineFX has been in the process of building fluorinefx and. NET development environments from the previous article, and here we look at this example:

1 <mx:RemoteObject id="service" destination="fluorine"
2 source="FlexDotNet.ServiceLibrary.Sample">
3 <mx:method name="Echo" result="onResult(event)">
4 </mx:method>
5 </mx:RemoteObject>
1 <mx:Script>
2 <![CDATA[
3 import mx.rpc.events.ResultEvent;
4 internal function onClick():void
5 {
6 service.Echo(txtInput.text);
7 }
8
9 internal function onResult(evt:ResultEvent):void
10 {
11 txtResult.text = evt.result.toString();
12 }
13 ]]>
14 </mx:Script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.