2 Replies Latest reply on Apr 15, 2007 3:39 PM by FlexBuilder1

    Write/Modify External XML File

    FlexBuilder1
      Can anyone provide simple server-side code and/or Flex App that will write or modify external XML file on a server?
      I am curious and would like to see how this would be done in ColdFusion, PHP, JSP, and/or ASP page.
      Your help/input is much appreciated!

      I have tried the example posted by Tracy(ntsiii ) on 03/14/2007 01:31:07 AM :
      http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=544
      but it kept giving me the following error: 1090 XML parser failure: element is malformed when I ran my Flex application. I know I have provided a valid URL and a well-formed XML file. What's missing?
      Please help!
        • 1. Re: Write/Modify External XML File
          ntsiii Level 3
          If you hit the url directly from a browser, what do you see?
          Tracy
          • 2. Re: Write/Modify External XML File
            FlexBuilder1 Level 1
            When I try to hit the URL( http://MyDomain/ProjectName/GetOrPutFile.aspx) directly from a browser
            I get this:
            <lt_status status="error" statusdescription="Request argument: getorput not provided. Must be get or put" exceptionmessage="" exceptionstring="" />

            In my Flex Application, I have the following code:

            [Bindable]
            private var _sGetOrPutFileURL:String = "GetOrPutFile.aspx"

            <mx:HTTPService id="serviceGetOrPutDataFile"
            resultFormat="e4x"
            url="{_sGetOrPutFileURL}"
            result="onResultGetOrPutDataFile(event)"
            fault="onFaultGetOrPutDataFile(event)"
            />

            In my GetOrPutFile.aspx file,
            I have this:
            <%@ Import Namespace="System.IO" %>
            <%@ Import Namespace="System.Web.HttpUtility" %>
            <%@ Page Language="vb" Strict="True" ValidateRequest="False" %>
            <%Response.ContentType = "text/xml" %>

            <SCRIPT language="vb" runat="server">
            'example urls:
            'bin\GetOrPutFile.aspx?getorput=get&fullfilespec=XML\test.xml
            'bin\GetOrPutFile.aspx?getorput=put&fullfilespec=XML\test.xml&content=<User><name></name> </User>

            Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Response.Buffer = True
            Response.BufferOutput = True
            dim sGetOrPut as string = nullHandler(Request("getorput")) 'handle missing request arg

            If Len(sGetOrPut) = 0 Then
            Response.Write("<lt_status status='error' statusdescription='Request argument: getorput not provided. Must be get or

            put' " _
            & "exceptionmessage='' " _
            & "exceptionstring='' " _
            & "/>")

            It looks like it's not getting the Request handler "getorput".
            Is something wrong with my URL or its content?