How to send xml to javascript from flex?
Hello,
I am using Flex Builder......I read blogs and wonderful tutorials on adobe website. But I found that I can only have data from Flex to script placed within main.template.html file.....when i tried to get same data by in my other .html or .aspx page, it did not work. Another thing I noticed in following tutorial
http://blog.flexexamples.com/2008/03/09/calling-javascript-functions-from-your-flex-applic ations-using-the-externalinterface-api/
is that we placed <iframe> in our html page to host flex object instead of using <object> tag etc.
Please just let me know how to do very same thing as defined in tutorial but by hosting out flex object using <object><embed> tags etc and how to get data into our .html or .aspx page rather putting javascript (to receive data) in main.template.html file generated by Flex Builder...???
Thanks for replying,
Now I am facing another problem....I have added a script tag in index.template.html file that also contains other useful code used in my aspx page. I wanted to have that reply on my aspx page. So I placed all the script in a Core.js file and also the recieving method from flex in same Core.js file. I thought this way i will be able to access data coming from flex project to my aspx page. But something strange is happening, when i run .html file in bin-debug folder it fires receiving method placed in Core.js........but when I host that flex project .html file in my aspx page, it is not firing method. And also not firing when I run .html in bin-release folder....what am I doing wrong?
Similar Messages
-
How to send XML using UTL_HTTP
I am trying to workout how to send XML data to a webserver using UTL_HTTP but am not getting any reply
I need to submit the following XML document to a server "http://api.fastsms.co.uk/api/xmlapi.php" Their instructions are "The XML Document should be posted unencoded, with a UTF-8 character set as parameter 'xml'"
If I submit the following XML on their test form
<?xml version="1.0"?>
<apirequest version="1">
<user>
<username>**USER**</username>
<password>**PASSWORD**</password>
</user>
<application>
<name>Example Application</name>
<version>1.0</version>
</application>
<inboundcheck lastid="10711399"/>
</apirequest>
I get an XML response back with the messages in my inbox.
This is the code I am trying to use to accomplish the same from PL/SQL : I know a response is coming back as there is header information - just no content. What am I doing wrong ?
l_xml VARCHAR2(5000);
req utl_http.req;
resp utl_http.resp;
header_name VARCHAR2(256); -- Response header name
header_value VARCHAR2(1024); -- Response header value
response_text VARCHAR2(4000); -- Response body
l_url VARCHAR2(100);
BEGIN
l_xml := 'xml=<?xml version="1.0"?>';
l_xml := '<apirequest version="1">';
l_xml := '<user>';
l_xml := '<username>**USER**</username>';
l_xml := '<password>**PASSWORD**</password>';
l_xml := '</user>';
l_xml := '<application>';
l_xml := '<name>Example Application</name>';
l_xml := '<version>1.0</version>';
l_xml := '</application>';
l_xml := '<inboundcheck lastid="10711399"/>';
l_xml := '</apirequest>';
-- Open HTTP connection
l_url := 'http://api.fastsms.co.uk/api/xmlapi.php';
req := utl_http.begin_request(l_url,'POST',utl_http.HTTP_VERSION_1_1);
-- Set headers for type and length
utl_http.set_header(req,'Content-Type','application/x-www-form-urlencoded');
utl_http.set_header(req,'Content-Length',to_char(length(l_xml)));
-- Write parameter
utl_http.write_text(req,l_xml);
-- Read response file
resp := utl_http.get_response(req);
-- Print out the response headers
FOR i IN 1 .. utl_http.get_header_count(resp) LOOP
utl_http.get_header(resp,i,header_name,header_value);
logging_pkg.info(header_name || ': ' || header_value);
END LOOP;
-- Print out the response body
BEGIN
LOOP
utl_http.read_text(resp,response_text);
logging_pkg.info(response_text);
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
logging_pkg.info('End of body');
END;
-- close http connection
utl_http.end_response(resp);
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
Cheers,
BrentHi Billy
Yikes - how embarassing ! Thanks for pointing out my beginners mistake there. I've fixed my code - and also implemented the substitutions of parameters like you suggested - I like that approach.
Unfortunately the end result is no better - the line
utl_http.read_text(resp,response_text);
Still returns nothing back
The headers that are coming back are
Date: Thu, 04 Jul 2013 08:31:56 GMT
Server: Apache/2.2.16 (Ubuntu)
X-Powered-By: PHP/5.3.3-1ubuntu9.3
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Connection: close
I guess I will need to try chasing it with the fastsms vendor so see if they can check my incoming request and see if there are any glaring problems. I know the xml is correct as I am now logging the xml string just before I send it and when I take that string and put it in their test form it works perfectly - something else in the puzzle is missing. I've had no experience using utl_http before - perhaps it's no possible to read the xml repsonse using this ?
Anyway, thanks for your help Billy.
ps - How do you paste your code into your message to get that formatting ?
Cheers,
Brent -
Sending attachments/binary data from flex to Restful APIs
Hi,
We have a requirement of sending the files (or binary data) from flex GUI to Restful services(backend APIs). We are using flex HTTPService component to invoke the rest apis. The Rest APIs are designed to accept the multipart/mixed data which can support the binary data as well.
Can any one help us understand, how can we send the multipart/mixed OR multipart/form-data from flex to backend using the HTTPService. Or is there a better way to send the mixed data from Flex GU to Restful APIs.
Request you to please respond to this at the earliest as this is very urgent.
Thanks and Regards,
--RevanthHas anyone worked on this issue?? i wanted a quick response as we are in the middle of the development and this is a r
equirement
Thanks
-Revanth -
How to send Itune gift card from UK to Malaysia?
How to send Itune gift card from UK to Malaysia? Would like to send it as a gift to my Malaysia friend, However, store officials said that itune card bought in UK are only for UK account. Is that true?
They're correct. If desired, send the money with an international cheque instead of through iTunes.
(126705) -
How to send XML file to https server using POST
Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
Thanks,Can anybody give me the solution
-
how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet
Hello
For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
Also, take a look at FTP Browser.vi, which is available at the Example Finder.
To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
Post your current VI if possible.
Regards
Mondoni -
Can anybody tell me how to send/receive the sms from java application
Hi All,
Can any body tell me, how to send/receive the sms from java application to mobile phones.
I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
the following error.
Cannot connect to GSM Device, error : -11Which jsms? Google finds several.
Try the website where you downloaded it. -
Can any body tell me, how to send/receive the sms from java application
Hi All,
Can any body tell me, how to send/receive the sms from java application to mobile phones.
I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
the following error.
Cannot connect to GSM Device, error : -11The best place to ask your question is at the JSMS website, forum or mailing list since this is no error that directly comes from a class belonging to the core Java classes.
-
How to send sms to mobile from tomcatserver using java code?
Hi,
Could you please let me know that,
How to send sms to mobile from tomcatserver using java code? Please provide the code snippet.
Thanks in advance.Yes, but something needs to send that message. You can't just take an arbitrary computer and send an SMS, it does not have the hardware to do that.
So either you have a mobile through which you do that or more likely - you use some sort of online service to do it. Whatever choice you make will determine what code you will have to write to get it done. Nobody is going to deliver the code to you, that's your job. It is also your job to figure out what service you are going to use. -
How to send SMS thru SMPP from PL/SQL
How to send SMS thru SMPP from PL/SQl or forms application. SMPP interface setuped in the SMSC. Requirement is send to SMS's to custoemrs thru our forms application.
How to send SMS thru SMPP from PL/SQl or forms application. SMPP interface setuped in the SMSC. Requirement is send to SMS's to custoemrs thru our forms application.
-
How does one upload a file from flex to a cfc
How does one upload a file from flex to a cfc? Can you do the file upload via remote object? I usually do uploads cia cfm but prefer the asnc capabilities of remote object calls.
Hi,
The issue here is myFile. For flex we need to pass this name as paramenter becuase it's not html form item like:
<cfcomponent>
<cffunction name="uploadFile" access="remote" output="false" returntype="void">
<cfargument name="file" required="Yes" type="any">
<cffile action="upload" filefield="#arguments.file#" destination="C:\temp\" nameconflict="makeunique">
</cffunction>
</cfcomponent>
From flex I'm getting the file using fileReference like:
private function browseAndUpload():void
fileReference = new FileReference();
fileReference.addEventListener(Event.SELECT,fileReference_Select);
fileReference.addEventListener(Event.CANCEL,fileReference_Cancel);
fileReference.browse();
private function fileReference_Select(event:Event):void
fileReference.addEventListener(ProgressEvent.PROGRESS,fileReference_Progress);
fileReference.addEventListener(Event.COMPLETE,fileReference_Complete);
fileReference.addEventListener(IOErrorEvent.IO_ERROR,onLoadError);
//fileReference.upload(request);
fileName = fileReference.name;
myFile.htmlText = fileReference.name;
SM_RO.importNSA();
filerReference have an upload method to upload the file but I can't use that becuase I need to process my upload with my cfc.
I'm getting an error:
Failed to import the file. The cffile action="upload" requires forms to use enctype="multipart/form-data". Please also make sure the file is not open.
I can't find the way to setup the enctype becuase again i can have html form items in flex, or I can?
Thanks
Johnny -
Need Help with send raw xml to PHP from flex
Hello all,
I am trying to pass raw XML from flex to php.
I can pass the data using get but need to use POST.
When I submit the data via POST
the data is not available in $HTTP_RAW_POST_DATA.
Any help is greatly appreciattedHello all,
I am trying to pass raw XML from flex to php.
I can pass the data using get but need to use POST.
When I submit the data via POST
the data is not available in $HTTP_RAW_POST_DATA.
Any help is greatly appreciatted -
How to send xml file from local folder to azure storage
Hi,
My plan is i have xml files which are under folders in my local.
I want to use mobile service to send xml files to azure storage,
how shall i do that, either by c# or mobile service.
If internet stop, I will use my mobile service to transfer all xml files to azure storage and run web job to do to update azure
sql by xml file.
please advice.
SupermanHi,
You could refer the following link for assistance with uploading image files to Azure Blob Storage using Mobile Services:
http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/
And for image files you could refer the following link:
http://stackoverflow.com/questions/25977406/upload-a-text-file-with-azure-mobile-services
Regards,
Malar. -
How to send vendor IDOC data from SAP R/3 to XI.
Hi experts,
I have developed the IDOC to FILE scenario for Vendor Master Upload. I want to place flat file in local folder with in XI or Outside of XI. (Using NFS or FTP protocol in FILE adapter). My First quesstion is How to setup Folder with in XI ro Out side XI?
And also I want to push the IDOC from SAP r/3 to test the scenario. Both XI and R/3 systems are configured to exchange data.
How to Push Vendor IDOC from SAP R/3 to XI? (we can send XML directly to XI; but the R/3 kernal should be moe than 6.20).
Thanks in Advance.....Hi,
>>My First quesstion is How to setup Folder with in XI ro Out side XI?
Its a normal way to creation of folders in Os level . u can create the folder in XI Server or on the FTP Server.
ALE Settings
Steps
SAP XI
1) RFC Destination (SM59)
a) Choose create.
b) Specify the name of the RFC destination
c) Select connection type as 3 and save
d) In the technical settings tab enter the details SAP SID/URL and system number#.
e) Enter the Gateway host as same details above SID/URL.
f) Gateway service is 3300+system number#.
g) In the Logon /Security tab, enter the client user & Password details of Destination system.
h) Test the connection and remote logon.
2) Create Port (IDX1)
a) Select create new button
b) Enter the port name as SAP+SID (The starting char should be SAP)
c) Enter the destination client.
d) Enter the RFC Destination created in SAP R/3 towards other system.
e) Save
3) Load Meta Data for IDOC (IDX2)
a) Create new
b) IDOC Message Type
c) Enter port created in IDX1.
SAP R/3
1) RFC Destination (SM59)
a) Choose create.
b) Specify the name of the RFC destination
c) Select connection type as 3 and save
d) In the technical settings tab enter the details SAP SID/URL and system number#.
e) Enter the Gateway host as same details above SID/URL.
f) Gateway service is 3300+system number#.
g) In the Logon /Security tab, enter the client user & Password details of Destination system.
h) Test the connection and remote logon.
2) Create Port (We21)
a) First Select Transactional RFC and then click create button
b) Enter the destination port name as SAP+SID (The starting char should be SAP)
c) Enter the destination client.
d) Enter the RFC Destination created in SAP R/3 towards other system.
e) Save
3) Create Partner Profile (WE20)
a) Create New
b) Create the Partner no. name as same the logical system name of the destination system.
c) Select Partner type LS
d) Enter details for Type: US/USER, Agent, and Lang.
e) Click on the + button to select the message type.
f) Select Partner no. and LS which ever create above.
g) Select Message type
h) Select Process code related to the Message type.
I) save.
In SLD System Landscape Directory
TS for R/3 (Logical system):-Assign the client name created in R/3 as Logical system Name.
Ts for Third Party (Logical system):-
BS for SAP R/3 (Logical system):- Assign the client name created in R/3 as Logical system Name.
BS for Third Party (Logical system):-Enter the XI logical system name.
In Transaction SALE
Define and Assign the logical system name.
IDoc-XI-File scenario
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
Posting the IDOC from R/3 to XI
/people/sameer.shadab/blog/2005/07/25/reposting-idocs-instead-of-recreating--for-testing-purpose-xi
REgards
Seshagiri -
How to Call a AIR application from Flex Application
Hi,
I have Used AIR (Desktop application) in Flex Builder to Upload a File from a local path and save it it a server path.
I need to Call this AIR(Desktop application) from my Flex Application.... i.e
I am using a link button to send a event using Script and Forward that Desktop application from Flex Screen
But it doesnot load that (Desktop application) in Screen. Only Balnk screen is loaded from path
Here is the code
AIR(Desktop application)
<?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="openBrowseWindow();">
<mx:HTTPService id="urlpath" showBusyCursor="true" useProxy="false" method="
POST" url="http://localhost:8080/nat/FlexAction.do?method=UrlPath"result="pathresult(event)"
fault="faultHandler(event)"
>
</mx:HTTPService>
<mx:Script>
<![CDATA[
import mx.events.FileEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.utils.ObjectUtil;
import mx.controls.Alert;
private
var openFile:File = new File()
private
function openBrowseWindow():void{openFile.addEventListener(Event.SELECT, onOpenFileComplete);
openFile.addEventListener(Event.OPEN, load);
openFile.browse();
private
function load():void{Alert.show(
"load");
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
//var textTypes:FileFilter = new FileFilter("Text Files (*.txt, *.rtf)", "*.txt; *.rtf");
var allTypes:Array = new Array(imageTypes);openFile.browse(allTypes);
private
function faultHandler(event:FaultEvent):void {
//Alert.show("Fault")Alert.show(ObjectUtil.toString(event.fault));
private
function pathresult(event:ResultEvent):void{Alert.show(
"res")
//Alert.show(ObjectUtil.toString(event.result));}private
function onOpenFileComplete(event:Event):void{
//mx.controls.Alert.show("event: "+event.target.nativePath +"UR!!!");
var pPath = event.target.nativePath;
var parameters:Object = {FlexActionType:"PATH",path:pPath};
// Alert.show("Image Selected from Path : "+pPath); urlpath.send(parameters);
//Alert.show("Passed.."+parameters);}
]]>
</mx:Script>
<mx:Button click="openBrowseWindow();onOpenFileComplete(event)" name="Upload" label="Upload" x="120.5" y="10"/>
Here is Mxml Code for Flex Application
<?xml version="1.0" encoding="utf-8"?><mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="http://ns.adobe.com/air/application/1.0.M4" >
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function Upload():void{
// CursorManager.setBusyCursor();
//var url:String = "HomeAction.do?method=onLoad";
//var url:String = "assets/Air.swf";
var url1:URLRequest = new URLRequest("assets/Air.swf");navigateToURL(url1,
"_self");
// CursorManager.removeBusyCursor(); }
]]>
</mx:Script>
<mx:LinkButton id="up" click="Upload()" x="295" y="215" label="UpLoad"/>
In this code i forward using s url to Open tat Desktop application but a blank screen appears with out the proper output...
Please Help me in this to forward AIR from Flex Screen..
Thanks in Advance
With Regards
Gopinath.A
Software Developer
First Internet Systems Pvt. Ltd.,
Chennaitry this
http://www.leonardofranca.com/index.php/2009/09/17/launching-an-installed-air-application- from-the-browser/
regards
Leonardo França
Adobe Certified Expert Flex 3 with AIR
Adobe Certified Expert Rich Internet Application Specialist v1.0
Adobe Certified Expert Flash CS3 Professional
Certified Professional Adobe Flex 2 Developer
Adobe Certified Professional Flash MX 2004 Developer
http://www.leonardofranca.com
http://twitter/leofederal
Manager AUGDF - Adobe User Group do Distrito Federal
http://www.augdf.com.br
http://twitter/augdf
Maybe you are looking for
-
Why is no report available when Adobe Flash crashes?
Firefox 6.0.1 (problem started with Firefox 5) Flash: 10.3.183.7 OSX Lion The flash plugin crashes frequently; however, Firefox always says "No report available". How can I get crash information generated so that this bug can get fixed? It crashes wh
-
Issue with ALV sceen called using BDC in new task and in background mode
Hi Gurus, Need your expert advice. I am trying to call one transaction (IS AUTO - VELO) which has ALVs on screen. VELO is being called through BDC in NEW TASK in background. So, the new session is a Dialog session and SY-BATCH is initial here. In two
-
Spring framework with JDeveloper
Hi, I'm developing to an application using JDeveloper. I need to use Spring framework, somebody has used it, integrating it with JDeveloper ? Thanks
-
Hello, where can I find a good documentation to use XML_TYPE in Oracle ??? (all the funtions like : extract, update XML_TYPE ...) Thx
-
Can I connect my Time Capsule directly to the Verizon FIOS ONT?
Hi I'm getting rid of Verizon FIOS TV and phone, but keeping FIOS Internet. My ONT is a TELLABS 612A, the ethernet port is active and connecting to the Verizon router without a problem. The coax is gone -- toast. The Time Capsule is connected to the