6 Replies Latest reply on Nov 6, 2007 1:40 PM by ntsiii

    Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider="{myServiceXML.lastResult.DataSet}">

    david.larew
      Result:
      <wsdl:definitions targetNamespace=" http://tempuri.org/" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm=" http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime=" http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns=" http://tempuri.org/" xmlns:s=" http://www.w3.org/2001/XMLSchema" xmlns:soap12=" http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http=" http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
      <s:schema elementFormDefault="qualified" targetNamespace=" http://tempuri.org/">
      <s:element name="Get_xplan_tpu">
      <s:complexType/>
      </s:element>
      <s:element name="Get_xplan_tpuResponse">
      <s:complexType>
      <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="Get_xplan_tpuResult">
      <s:complexType>
      <s:sequence>
      <s:element ref="s:schema"/>
      <s:any/>
      </s:sequence>
      </s:complexType>
      </s:element>
      </s:sequence>
      </s:complexType>
      </s:element>
      <s:element name="Get_xplan_msc">
      <s:complexType/>

      etc....


      <?xml version="1.0" encoding="utf-8" ?>
      - <DataSet xmlns=" http://tempuri.org/">
      + <xs:schema id="NewDataSet" xmlns="" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      - <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      - <xs:complexType>
      - <xs:choice minOccurs="0" maxOccurs="unbounded">
      - <xs:element name="xplan_MSC_Planning">
      - <xs:complexType>
      - <xs:sequence>
      <xs:element name="MSC" type="xs:string" minOccurs="0" />
      <xs:element name="Date" type="xs:dateTime" minOccurs="0" />
      <xs:element name="Traffic" type="xs:decimal" minOccurs="0" />
      <xs:element name="Radios" type="xs:int" minOccurs="0" />
      <xs:element name="InstalledCapacity" type="xs:int" minOccurs="0" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:choice>
      </xs:complexType>
      </xs:element>
      </xs:schema>
      - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
      - <NewDataSet xmlns="">
      - <xplan_MSC_Planning diffgr:id="xplan_MSC_Planning1" msdata:rowOrder="0">
      <MSC>NYGMSC01</MSC>
      <Date>2007-06-24T00:00:00-07:00</Date>
      <Traffic>12730.8400</Traffic>
      <Radios>676</Radios>
      <InstalledCapacity>12342</InstalledCapacity>
      </xplan_MSC_Planning>


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      backgroundColor="#f6f6f6"
      backgroundGradientColors="[#f6f6f6, #bbbbbb]"
      creationComplete="myServiceXML.send()">


      <!-- Script -->
      <!-- Our result handler functions get any value returned from the server -->
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      // you import the event classes for strong typing
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;


      public function handleResultXML(event:ResultEvent):void {
      // the result object is your xml root
      lastResultValue.text = "Result:\n" + event.result;
      // you get the row nodes of your result object http://localhost:1343/***/DataService.asmx?op=Get_xplan_msc
      // the data of the dataprovider populates the component http://www.flexcapacitor.com/examples/php/datagrid_xml.php
      myDataGrid.dataProvider = event.result.row;

      }

      // this function is called when you get an error from the server http://localhost:1343/***/DataService.asmx?wsdl
      public function handleFault(event:FaultEvent):void {
      lastResultValue.text = "Fault: " + event.fault.faultDetail;
      //trace(myServiceXML.toXMLString());
      }
      // var myService:XML = XML(event.result);
      //trace(myService.toXMLString());

      ]]>
      </mx:Script>

      <!-- Data Communications -->
      <!-- The url is the page you post to -->
      <!-- In the request object you add your name and value pairs -->
      <!-- The curly brackets surrounding "username.text" get the value of username.text -->
      <!-- Note: The curly brackets are also used for databinding where supported -->

      <!-- Note: We set the resultFormat to E4X to automatically convert your return string to an XML object with E4X support -->
      <mx:HTTPService id="myServiceXML" url=" http://localhost:1343/***/DataService.asmx?wsdl"
      method="POST" result="handleResultXML(event)" fault="handleFault(event)"
      useProxy="false" resultFormat="e4x">



      </mx:HTTPService>

      <!-- Layout -->
      <mx:Label x="10" y="10" text="Populate DataGrid with XML" fontSize="20" fontWeight="bold"/>
      <mx:HRule x="10" y="49" width="80%"/>
      <mx:Button id="submit0" x="10" y="73" label="Get XML" click="myServiceXML.send()"/>
      <mx:Label x="10" y="228" text="Result"/>
      <mx:DataGrid id="myDataGrid" x="10" y="114" width="611" height="106" dataProvider="{myServiceXML.lastResult.DataSet}">

      <mx:columns>
      <mx:DataGridColumn headerText="xplan_MSC_Planning" dataField="Traffic"/>
      <mx:DataGridColumn headerText="MSC" dataField="MSC"/>
      </mx:columns>
      </mx:DataGrid>
      <mx:TextArea x="10" y="244" width="611" height="400" id="lastResultValue"/>

      </mx:Application>
        • 1. Re: Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider=&quot;{myServiceXML.lastResult.DataSet}&quot;&gt;
          david.larew Level 1
          When I try this dot op approach myServiceXML.Get_xplan_msc.lastResult.DataSet
          I get...

          2 1119: Access of possibly undefined property Get_xplan_msc through a reference with static type mx.rpc.http.mxml:HTTPService. FlexChartSample.mxml FlexChartSample line 58 November 2, 2007 7:58:43 PM 66
          • 2. Re: Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider=&quot;{myServiceXML.lastResult.DataSet}&quot;&gt;
            ntsiii Level 3
            You are using HTTPService to access a SOAP Web Service. You need to use mx:WebService instead. Here is a simple example:
            http://www.cflex.net/showFileDetails.cfm?ObjectID=582

            Tracy
            • 3. Re: Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider=&quot;{myServiceXML.lastResult.DataSet}&quot;&gt;
              david.larew Level 1
              Thanks Tracy,
              I'm still having a hard time with this.

              Error: Cannot assign operations into an RPC Service (url)
              at mx.rpc::AbstractService/ http://www.adobe.com/2006/actionscript/flash/proxy::setProperty()
              at GrowthRates/::_WebService1_i()
              at GrowthRates$iinit()
              at _GrowthRates_mx_managers_SystemManager/create()
              at mx.managers::SystemManager/::initializeTopLevelWindow()
              at mx.managers::SystemManager/::docFrameHandler()


              Please, look at this code.

              <?xml version="1.0" encoding="utf-8"?>

              <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
              xmlns="*" backgroundColor="white"
              creationComplete="this.servlet.send();">

              <mx:WebService id="servlet" url=" http://localhost:1343/***/DataService.asmx/Get_xplan_msc"/>
              <mx:AreaChart id="areachart1" dataProvider="{servlet.result.DataSet.xplan_MSC_Planning}">
              <mx:series>
              <mx:AreaSeries displayName="MSC" yField="MSC"/>
              <mx:AreaSeries displayName="Date" yField="Date"/>
              <mx:AreaSeries displayName="Traffic" yField="Traffic"/>
              <mx:AreaSeries displayName="Radios" yField="Radios"/>
              <mx:AreaSeries displayName="InstalledCapacity" yField="InstalledCapacity"/>
              </mx:series>
              </mx:AreaChart>
              <mx:Legend dataProvider="{areachart1}"/>
              </mx:Application>
              ////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
              ///////////////////////// http://localhost:1343/***/DataService.asmx/Get_xplan_msc


              <?xml version="1.0" encoding="utf-8" ?>
              - <DataSet xmlns=" http://tempuri.org/">
              - <xs:schema id="NewDataSet" xmlns="" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
              - <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
              - <xs:complexType>
              - <xs:choice minOccurs="0" maxOccurs="unbounded">
              - <xs:element name="xplan_MSC_Planning">
              - <xs:complexType>
              - <xs:sequence>
              <xs:element name="MSC" type="xs:string" minOccurs="0" />
              <xs:element name="Date" type="xs:dateTime" minOccurs="0" />
              <xs:element name="Traffic" type="xs:decimal" minOccurs="0" />
              <xs:element name="Radios" type="xs:int" minOccurs="0" />
              <xs:element name="InstalledCapacity" type="xs:int" minOccurs="0" />
              </xs:sequence>
              </xs:complexType>
              </xs:element>
              </xs:choice>
              </xs:complexType>
              </xs:element>
              </xs:schema>
              - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
              - <NewDataSet xmlns="">
              - <xplan_MSC_Planning diffgr:id="xplan_MSC_Planning1" msdata:rowOrder="0">
              <MSC>NYGMSC01</MSC>
              <Date>2007-06-24T00:00:00-07:00</Date>
              <Traffic>12730.8400</Traffic>
              <Radios>676</Radios>
              <InstalledCapacity>12342</InstalledCapacity>
              </xplan_MSC_Planning>
              - <xplan_MSC_Planning diffgr:id="xplan_MSC_Planning2" msdata:rowOrder="1">
              <MSC>NYGMSC01</MSC>
              <Date>2007-09-30T00:00:00-07:00</Date>
              <Traffic>13591.4000</Traffic>
              <Radios>705</Radios>
              <InstalledCapacity>12342</InstalledCapacity>
              </xplan_MSC_Planning>
              - <xplan_MSC_Planning diffgr:id="xplan_MSC_Planning3" msdata:rowOrder="2">

              ..........................................
              </xplan_MSC_Planning>
              </NewDataSet>
              </diffgr:diffgram>
              </DataSet>
              • 4. Re: Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider=&quot;{myServiceXML.lastResult.DataSet}&quot;&gt;
                ntsiii Level 3
                I am not a big user of WebService, but I think you need to separate the url from the operation:
                The url=" http://localhost:1343/***/DataService.asmx


                The operation is "Get_xplan_msc"

                Also, this won't work:
                dataProvider="{servlet.result.DataSet.xplan_MSC_Planning}"

                Declare a result handler on your operation.


                Follow the example.

                Tracy
                • 5. Re: Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider=&quot;{myServiceXML.lastResult.DataSet}&quot;&gt;
                  david.larew Level 1
                  I haven't been able to see the results from my web service. I'm seeing this error.
                  It might be an internal security issue...I'm not sure why...any help is greatly
                  appreciated.
                  David

                  - <s:element name="Get_xplan_msc">
                  <s:complexType />
                  </s:element>
                  - <s:element name="Get_xplan_mscResponse">
                  - <s:complexType>
                  - <s:sequence>
                  - <s:element minOccurs="0" maxOccurs="1" name="Get_xplan_mscResult">
                  - <s:complexType>
                  - <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                  </s:sequence>
                  </s:complexType>
                  </s:element>
                  </s:sequence>
                  </s:complexType>
                  </s:element>

                  [WSDLError faultString="Element http://tempuri.org/:Get_xplan_mscResponse not resolvable" faultCode="WSDL.BadElement" faultDetail="null"]
                  at mx.rpc.soap::WSDLParser/ http://www.adobe.com/2006/flex/mx/internal::parseMessage()
                  at mx.rpc.soap::WSDLOperation/parseMessages()
                  at mx.rpc.soap::Operation/ http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()
                  at mx.rpc.soap::Operation/ http://www.adobe.com/2006/flex/mx/internal::invokeAllPending()
                  at mx.rpc.soap::WebService/::unEnqueueCalls()
                  at mx.rpc.soap::WebService/ http://www.adobe.com/2006/flex/mx/internal::wsdlHandler()
                  at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
                  at flash.events::EventDispatcher/dispatchEvent()
                  at mx.rpc.soap::WSDLParser/dispatchEvent()
                  at mx.rpc.soap::WSDLParser/::parseCompleted()
                  at mx.rpc.soap::WSDLParser/ http://www.adobe.com/2006/flex/mx/internal::httpResultHandler()
                  at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
                  at flash.events::EventDispatcher/dispatchEvent()
                  at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
                  at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler()
                  at mx.rpc::Responder/result()
                  at mx.rpc::AsyncRequest/acknowledge()
                  at ::DirectHTTPMessageResponder/completeHandler()
                  at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
                  at flash.events::EventDispatcher/dispatchEvent()
                  at flash.net::URLLoader/flash.net:URLLoader::onComplete()


                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
                  backgroundColor="#f6f6f6"
                  backgroundGradientColors="[#f6f6f6, #bbbbbb]"
                  creationComplete="getXplan_MSC()">


                  <!-- Script -->
                  <!-- Our result handler functions get any value returned from the server -->
                  <mx:Script>
                  <![CDATA[
                  import mx.collections.ArrayCollection;
                  // you import the event classes for strong typing
                  import mx.rpc.events.ResultEvent;
                  import mx.rpc.events.FaultEvent;
                  import mx.controls.dataGridClasses.DataGridColumn;
                  import mx.managers.CursorManager;
                  import mx.controls.Alert;

                  default xml namespace = " http://localhost:1343"; //necessary to access the xml elements easily

                  [Bindable]private var _xmlResult:XML; //holds the result xml
                  [Bindable]private var _xlDayData:XMLList; //dataProvider for the day weather dataGrid
                  [Bindable]private var _sPlace:String;

                  /** invokes the web service operation to get the weather */
                  private function getXplan_MSC():void
                  {
                  CursorManager.setBusyCursor();
                  WS.Get_xplan_msc.send();
                  //lastResultValue.text = "Result:\n" + event.result.Get_xplan_msc;
                  }

                  /** called by the WebService result event. Sets the dataProviders as necessary */
                  private function onResult(oEvent:ResultEvent):void
                  {
                  _xmlResult = XML(oEvent.result);
                  //var xmlResultNode:XML = _xmlResult.Get_xplan_mscResult[0];
                  // var xmlDetailsNode:XML = xmlResultNode.Details[0];
                  //outputInfo.text = xmlDetailsNode.toXMLString();
                  //outputInfo.text = _xlDayData.text();
                  // outputInfo.text = _xmlResult.toXMLString();
                  // outputInfo.text = xmlResultNode.MSC.text();// + ", " + xmlResultNode.StateCode.text();
                  // _xlDayData = xmlDetailsNode.toXMLString();//Get_xplan_mscResult[0];
                  outputInfo.text = _xmlResult.text();
                  CursorManager.removeBusyCursor();
                  }//onResult

                  /** labelFunction for DataGrid. It seems that the namespace on the xml makes
                  * using the DataGridColumn dataField not work. At least I couldn't get it to work. */





                  public function handleResultXML(event:ResultEvent):void {
                  // the result object is your xml root
                  lastResultValue.text = "Result:\n" + event.result.Get_xplan_msc;
                  // you get the row nodes of your result object http://localhost:1343/***/DataService.asmx?op=Get_xplan_msc
                  // the data of the dataprovider populates the component http://www.flexcapacitor.com/examples/php/datagrid_xml.php
                  //myDataGrid.dataProvider = event.result.row[0];

                  }

                  // this function is called when you get an error from the server http://localhost:1343/***/DataService.asmx?wsdl
                  public function handleFault(event:FaultEvent):void {
                  lastResultValue.text = "Fault: " + event.fault.faultDetail;
                  lastResultValue.text = "Fault: " + event.fault.faultDetail;
                  //trace(myServiceXML.toXMLString());
                  }
                  // var myService:XML = XML(event.result);
                  //trace(myService.toXMLString());

                  ]]>
                  </mx:Script>

                  <!-- Data Communications -->
                  <!-- The url is the page you post to -->
                  <!-- In the request object you add your name and value pairs -->
                  <!-- The curly brackets surrounding "username.text" get the value of username.text -->
                  <!-- Note: The curly brackets are also used for databinding where supported -->



                  <mx:WebService id="WS" wsdl=" http://localhost:1343/***/DataService.asmx?wsdl">
                  <mx:operation name="Get_xplan_msc" resultFormat="e4x" />
                  </mx:WebService>

                  <!-- Layout -->
                  <mx:Label x="10" y="10" text="Populate Chart with XML" fontSize="20" fontWeight="bold"/>
                  <mx:HRule x="10" y="49" width="80%"/>
                  <mx:Button id="submit0" x="139" y="199" label="Get XML" click="getXplan_MSC()"/>
                  <mx:Label x="10" y="228" text="Result"/>
                  <mx:TextArea x="10" y="244" width="333" height="400" id="lastResultValue"/>
                  <mx:TextArea x="377" width="354" height="400" id="outputInfo" y="244"/>

                  <!--
                  <mx:ColumnChart x="243" y="80" id="columnchart1" width="293" height="115" dataProvider="">
                  <mx:series>
                  <mx:ColumnSeries displayName="Date" yField="Date"/>
                  <mx:ColumnSeries displayName="MSC" yField="MSC"/>
                  <mx:ColumnSeries displayName="Traffic" yField="Traffic"/>
                  <mx:ColumnSeries displayName="Radios" yField="Radios"/>
                  </mx:series>
                  </mx:ColumnChart>
                  <mx:Legend dataProvider="{columnchart1}" x="108" y="100"/>
                  -->
                  </mx:Application>

                  • 6. Re: Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider=&quot;{myServiceXML.lastResult.DataSet}&quot;&gt;
                    ntsiii Level 3
                    It is not the cause of the error, but you don't appear to be listening for the result event.

                    I suggest you:
                    1) get an example to work, to the point where you can trace(myXML.toXMLString())
                    2) get that example to work with your WebService
                    3) copy the code to your real app

                    Tracy