4 Replies Latest reply on Oct 8, 2008 10:13 PM by bitwyse

    Stuck on SOAP WebService

      Okay, I have been banging my head against this code all day and still can't quite get it, although I have made some progress. I am trying to access A WebService through SOAP. I can get the request sent and everything and it returns the xml document as a result. But the problem is, I don't know how to access individual parts of that result. I think that the result is being sent as a string instead of XML, but I'm not sure how to fix that... I am very new to all of this (Just started using Flex and APIs and Mashups and SOAP and XML today lol) but I am excited to learn and would appreciate some pointers. Here is my code: (I am trying to make a mashup)

      wsdl=" http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"
      <mx:operation name="NDFDgen"



      public function showResults():void {

      The problem is that when I try to access data inside the xml I get errors. This is what I try to do:

      This is a sample of the xml file:
      <?xml version="1.0"?>
      <dwml version="1.0" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=" http://www.nws.noaa.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">
      <product srsName="WGS 1984" concise-name="time-series" operational-mode="official">
      <title>NOAA's National Weather Service Forecast Data</title>
      <creation-date refresh-frequency="PT1H">2008-05-20T07:04:30Z</creation-date>
      <more-information> http://www.nws.noaa.gov/forecasts/xml/</more-information>
      <production-center>Meteorological Development Laboratory<sub-center>Product Generation Branch</sub-center></production-center>
      <disclaimer> http://www.nws.noaa.gov/disclaimer.html</disclaimer>
      <credit> http://www.weather.gov/</credit>
      <credit-logo> http://www.weather.gov/images/xml_logo.gif</credit-logo>
      <feedback> http://www.weather.gov/feedback.php</feedback>

      Any ideas what I am doing wrong? Thanks in advance also any pointers to help my coding would be appreciated, I am very new.
        • 1. Re: Stuck on SOAP WebService
          Developer504 Level 1
          I'm new to Flex myself so take this with a grain of salt, but I think if your data source is XML you have to convert it using E4X to do more than a simple display. What specific errors are you getting?

          I have one program which reads XML from an HTTPService Post and snaps that to a datagrid, maybe you could try that.
          • 2. Re: Stuck on SOAP WebService
            wildkatana Level 1
            Hmmm. I think what I need to do is figure out a way to convert a string variable (the xml) to an xml variable. Any ideas on that? I have the xml data stored in a string variable right now, but I want to traverse it's contents using the '.' Any ideas?
            • 3. Re: Stuck on SOAP WebService

              Dont know if this is still a problem but here goes.. the easiest way is to use the XMLList.

              var list:XMLList = new XMLList(xmlString); From here you can traverse the list via Children() and such

              • 4. Re: Stuck on SOAP WebService
                bitwyse Level 1
                You can also do something like this:
                var myXML : XML = new XML( xmlStringData );
                myXMLdataFormat = "e4x";

                Then you could use simple e4x constructs to access the data like . . .
                myXML..nodeName or
                myXML.nodeName( @attribName )

                you can google flex e4x and find lot's of great e4x sample code.
                Hope that helps. . .