flex mxml Code :
<? XML version = "1.0" encoding = "UTF-8"?> <S: Application xmlns: FX = "http://ns.adobe.com/mxml/2009" xmlns: S = "Library: // ns.adobe.com/flex/spark" xmlns: MX = "Library: // ns.adobe.com/flex/mx "width =" 657 "Height =" 278 "minwidth =" 955 "minheight =" 600 "> <FX: SCRIPT> <! [CDATA [import MX. RPC. events. resultevent; protected function button#clickhandler (Event: mouseevent): void {obj. sayhello (text. text);} protected function method=resulthandler (Event: resultevent): void {result. TEXT = event. result as string ;}]]> </FX: SCRIPT> <FX: declarations> <s: remoteobject id = "OBJ" Destination = "product" endpoint = "/helloworld/messagebroker/AMF"> <s: method name = "sayhello" result = "method=resulthandler (Event) "> </S: method> </S: remoteobject> </FX: declarations> <FX: style> # result {fontsize: 22; fontweight: bold; fontfamily: ""; color: #00e3e3 ;}</FX: style> <s: button x = "140" Y = "135" label = "get result" Click = "button#clickhandler (event)"/> <s: label id = "result" x = "285" Y = "68" width = "235" Height = "36" backgroundalpha = "0.73"/> <s: textinput id = "text" x = "122" Y = "73"/> <s: label x = "34" Y = "73" Height = "21" text = "enter your name"/> </S: Application>
/Helloworld/webcontent/WEB-INF/flex/remoting-config.xml content is as follows:
<? XML version = "1.0" encoding = "UTF-8"?> <Service id = "remoting-service" class = "flex. messaging. Services. remotingservice">
<Adapters> <adapter-definition id = "Java-object" class = "flex. messaging. Services. remoting. adapters. javaadapter" default = "true"/> </adapters>
<Default-channels> <channel ref = "My-AMF"/> </default-channels> <destination ID = "product"> <! -- Corresponds to <s: remoteobject id = "OBJ" Destination = "product" --> <Properties> <source> COM. test. product </source> </Properties> </destination> </service>