Try switching destination  to url

destinations need to be preset in services-config.xml

url="http://10.176.95.32:8889/SunRestTest/sunTest/testRest";

Also add a fault handler would help so you can place a break point and look at 
fault event object for details.


--- In flexcoders@yahoogroups.com, "bjgindia" <bjgin...@...> wrote:
>
> Hi,
> 
> I have got the REST POST working thru simple HTML Form submit.
> This REST Service takes an XML and returns back an XML.
> 
> But, when I tried it with FLEX, I am getting "Couldn't establish a
> connection" errors:
> 
> FLEX CODE:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute">
>      <mx:HTTPService id="RESTService"
>          method="POST"
>         
> destination="http://10.176.95.32:8889/SunRestTest/sunTest/testRest";
>          resultFormat="e4x">
> 
>       <mx:request xmlns="">
>        {this.payload}
>       </mx:request>
>      </mx:HTTPService>
> 
>      <mx:Script>
>          <![CDATA[
>              private function processValues():void {
>                  RESTService.send();
>              }
>          ]]>
>      </mx:Script>
> 
> <mx:VBox width="100%" height="100%">
> <mx:Form width="100%" height="50%">
>          <mx:FormItem label="Payload" width="100%" height="100%">
>              <mx:TextArea id="payload" width="100%" height="80%"
>                  text="Paste or Type the XML Payload here:"/>
>              <mx:Button
>                  label="Submit"
>                  click="processValues();"/>
>          </mx:FormItem>
>      </mx:Form>
> 
>      <mx:TextArea width="100%" height="50%"
>          text=
>            "{RESTService.lastResult.toString()}"/>
> 
> </mx:VBox>
> 
> </mx:Application>
> 
> FAULT ON Clicking the Submit Button:
> 
> [RPC Fault faultString="[MessagingError message='Destination
> 'http://10.176.95.32:8889/SunRestTest/sunTest/testRest' either does not
> exist or the destination has no channels defined (and the application
> does not define any default channels.)']" faultCode="InvokeFailed"
> faultDetail="Couldn't establish a connection to
> 'http://10.176.95.32:8889/SunRestTest/sunTest/testRest'"]
> at
> mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::invo\
> ke()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvok\
> er.as:263]
> at
> mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal\
> ::invoke()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\mx\
> ml\HTTPService.as:249]
> at
> mx.rpc.http::HTTPService/send()[C:\autobuild\3.2.0\frameworks\projects\r\
> pc\src\mx\rpc\http\HTTPService.as:767]
> at
> mx.rpc.http.mxml::HTTPService/send()[C:\autobuild\3.2.0\frameworks\proje\
> cts\rpc\src\mx\rpc\http\mxml\HTTPService.as:232]
> at
> CallRESTServices/processValues()[D:\SourceCodes\FLEX_SOURCE\CallRESTServ\
> ices\src\CallRESTServices.mxml:17]
> at
> CallRESTServices/___CallRESTServices_Button1_click()[D:\SourceCodes\FLEX\
> _SOURCE\CallRESTServices\src\CallRESTServices.mxml:29]
> 
> Appreciate your useful suggestions.
> 
> thanks
> Bhaskar
>


Reply via email to