2 Replies Latest reply on Dec 22, 2008 9:12 AM by PeteApps

    Using ASP .Net web service

      Hi. I am a newbie that is trying to use an ASP .Net web service to retrieve and return rows from/to a database. These web services return XML and the Insert and Update web services also accept XML as input. I want to use XML rather than objects, since the binding with E4X works very well and I don't want to do endless updates to my objects as the schema changes.

      I have used the Data > Import Web Service (WSDL) wizard to create a set of classes. This looks way cool, but I am at a loss as to how to use them. Specifically, how do I bind the output from the SelectByKey to my form controls? Also, how can I build the XML to send back to the Update web service?

      Here is my original mxml source that I used to create a simple form. I have created a constant that has the same xml as returned by my web service. I have setup my mx:Binding to parse the xml to the page controls.

      I want to invoke the web service to retrieve the xml from the web service and populate the database. The next step will be to use the web service to update the row back to the server.

      How do I "Attach Code" to this post?
        • 1. Re: Using ASP .Net web service
          Zee Yang
          you might find this article useful, http://www.adobe.com/devnet/flex/articles/flex_ws.html

          note, flex only supports up to soap 1.1. i'm not an .net expert, but i believe it uses a higher version of soap by default. i would recommend you looking into weborb for .net instead.
          • 2. Re: Using ASP .Net web service
            PeteApps Level 1
            Hi, Zee. Thanks for the link to your article, it helped.

            Here is where I am at.

            I have a simple web service that returns XML. The web service was returning an ASP .Net XmlDocument, but that gave me an error in Flex on the return. It looks like Flex didn't know how to deal with that, complaining about the type. I changed the web service result to String. I added a listener like your example shows, where I take the string, cast it to XML and store it in a private variable. My mx:Binding statements then use the E4X expressions to map the appropriate XML nodes to the form. This is great and is very flexible. There is a very loose binding through the XML to my database.

            The next challenge for me is to reverse this process for updating records back to the web service via XML. I need to build an XML document from my controls on the page. Any ideas of where to look for classes to build an XML document from the page controls?

            Also, if anyone can give me a clue on how to "Attach Code" I would be glad to share what I have. I do not see an "Attach Code" button anywhere on the page. I have tried Camino, Firefox, and IE. It has taken me many hours more than I thought it would to get this far, perhaps sharing the code would save others some time and frustration.