Solved

How to pass a string using HTTP Service

Posted on 2008-10-06
8
816 Views
Last Modified: 2008-10-11
Hi, im trying to pass a string through to a Ruby on Rails backend, at the moment im using:
                    <mx:Button x="163" y="92" label="Search" width="199" click="searchByType.send('Hardware'); "/>
But its not working, anyone know how i can do this?
thanks
0
Comment
Question by:Jonesey007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22655978
can you check for the fault event and see the Fault message and post it here???

you can follow this example also

http://blog.flexexamples.com/2007/10/29/passing-parameters-to-an-httpservice/

but I think their is nothing wrong in the way you are doing it, and you are getting a n/w exception. check the  fault message you will get to know better
0
 

Author Comment

by:Jonesey007
ID: 22656932
Thanks for the reply, here's the error im getting, it seems to think im passing Hardware as a variable and not as a String

ReferenceError: Error #1065: Variable Hardware is not defined.
      at global/flash.utils::getDefinitionByName()
      at mx.utils::DescribeTypeCache$/describeType()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\utils\DescribeTypeCache.as:89]
      at mx.utils::ObjectUtil$/getClassInfo()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\utils\ObjectUtil.as:780]
      at mx.rpc.http::HTTPService/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:701]
      at mx.rpc.http.mxml::HTTPService/send()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http\mxml\HTTPService.as:217]
      at AssetDatabase/___AssetDatabase_Button4_click()[C:\Test\src\AssetDatabase.mxml:109]

Thanks

Pete
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22656995
ya the send method take a Object as param let me digg  in to it further

for now check it this works
add the following lines
   
<mx:Object id="myObj" name="Hardware" />

<mx:Button x="163" y="92" label="Search" width="199" click="searchByType.send(myObj); "/>
0
Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

 

Author Comment

by:Jonesey007
ID: 22693011
Hi, sorry for the long reply ive been away on business:
Unfortunately that didnt work, this is what I did,
private var myObj:Object = "Hardware";
<mx:Button x="163" y="92" label="Search" width="199" click="findByType.send(myObj); "/>
 This produced the same error as before ????
Thanks for the help,, really appreciate it
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22693085
NO Please try this directly

<mx:Object id="myObj" name="Hardware" />

else specify [Bindable] on top of the above myObject declaration. try and let me know.
0
 

Author Comment

by:Jonesey007
ID: 22693126
hmm, i tried <mx:Object id="myObj" name="Hardware" /> originally but get a compile error stating (component declarations are not allowed here(note visual children must implement mx.core.ICIComponent))

So i tried declaring the object in the ActionScript area, ive now tried making it bindable and that didnt help either?
0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 500 total points
ID: 22693214
sorry there was a mistake, the way the http parameters are always passed in key value pairs

check this :), Please try that and let me know, I am outside on some business trip hence don't have my Flex installation for trying your solution , generally I provide full solution with code.

http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=dataservices_099_09.html
0
 

Author Comment

by:Jonesey007
ID: 22693431
Thats better, the pair option works fine, thanks for the help
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question