Welcome, Guest. Please login or register.
Did you miss your activation email?
02/08/12, 07:57
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  Parsing XML web service in flash
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Parsing XML web service in flash  (Read 5342 times)
willie
Jr. Programmer
**
Posts: 61



View Profile Email
« on: 03/30/08, 00:09 »

Hi,

I am using a web service in AS3 found here - http://labs.alducente.com/index.php?page_id=13#comment-118

Everthing is set up and working, if you look at the the link you will see this line of code:
trace(serviceResposne)
It spits out this xml from my own data base in ASP.net 2.0:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <getTitlesResponse xmlns="http://tempuri.org/">
      <getTitlesResult>
        <xsd:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
          <xsd:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
            <xsd:complexType>
              <xsd:choice minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="Table">
                  <xsd:complexType>
                    <xsd:sequence>
                      <xsd:element name="title" type="xs:string" minOccurs="0"/>
                    </xsd:sequence>
                  </xsd:complexType>
                </xsd:element>
              </xsd:choice>
            </xsd:complexType>
          </xsd:element>
        </xsd:schema>
        <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
          <NewDataSet>
            <Table diffgr:id="Table1" msdata:rowOrder="0">
              <title>Biology ch1</title>
            </Table>
            <Table diffgr:id="Table2" msdata:rowOrder="1">
              <title>Vocabulary</title>
            </Table>
            <Table diffgr:id="Table3" msdata:rowOrder="2">
              <title>WWII</title>
            </Table>
            <Table diffgr:id="Table4" msdata:rowOrder="3">
              <title>Chemistry</title>
            </Table>
            <Table diffgr:id="Table5" msdata:rowOrder="4">
              <title>Measurment</title>
            </Table>
            <Table diffgr:id="Table6" msdata:rowOrder="5">
              <title>Biology ch2</title>
            </Table>
          </NewDataSet>
        </diffgr:diffgram>
      </getTitlesResult>
    </getTitlesResponse>
  </soap:Body>
</soap:Envelope>

How can I print the titles?

I have tried many combination of:
      trace(serviceResponse.NewDataSet.Table);
      trace(serviceResponse.soap::Envelope);

from other examples but nothing works.

Thanks
waffe
« Last Edit: 03/30/08, 00:24 by willie » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #1 on: 03/30/08, 02:38 »

assign this to a XML Object, then you can walk through it qith the XML methods.
Logged

happy flashing
Cool
Ronald
willie
Jr. Programmer
**
Posts: 61



View Profile Email
« Reply #2 on: 03/30/08, 03:36 »

I believe I have, here is flash code:

import alducente.services.WebService;
import flash.events.*;//Instantiate the class
var ws:WebService = new WebService();//Add a listener for when the web service methods become available
ws.addEventListener(Event.CONNECT, connected);

//Connect to the service by downloading the WSDL
ws.connect("http://localhost:52533/StudyBuddyFromScratch/Services/tests.asmx?WSDL");

//Once connected, call an available method on the service named "ResolveIP" with the appropriate parameters
function connected(evt:Event):void{
   //ws.ResolveIP(done, "192.123.0.200", 0);
   ws.getTitles(done);
}

//This function is called when there is a response from the sesrvice
function done(serviceResponse:XML):void{
   trace("nWeb Service Result: ");
   trace(serviceResponse);
}

When I try and print something other than serviceResponse it is always blank or flash has an error with my trace

waffe
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #3 on: 03/30/08, 04:27 »

just grab the result and use the xml methods on it.
read more details in the helpfile under XML.
Logged

happy flashing
Cool
Ronald
willie
Jr. Programmer
**
Posts: 61



View Profile Email
« Reply #4 on: 04/02/08, 00:08 »

I believe you think this is regular XML where you have a set up like

<music>
  <myMusic>
    <song>blue sky</song>
  </myMusic>
</music>

and have something like mySong = xml.music.myMusic.song

etc...

but this is not how it works from a webService

Here is a link to EE that explains this scenario.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_23280332.html

Thanks,
waffe
« Last Edit: 04/08/08, 22:03 by willie » Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything