13 Replies Latest reply on Oct 19, 2007 2:01 AM by newman_

    Web Service and result handler problem

    newman_
      Hi!
      I load WSDL file and then invoke addnumbers() method without problems. But I don't get any results. resultHandler and faultHandler silent after addnumbers invoke. Where is the problem???

      My code:
      ---------------------
      public function useWebService():void {
      WS = new WebService();
      WS.wsdl = "................?wsdl"

      WS.addEventListener("load", loadHandler);
      WS.addEventListener("fault",faultHandler);
      WS.useProxy = false;
      WS.loadWSDL();

      WS.addnumbers.addEventListener("result", resultHandler);
      WS.addnumbers.addEventListener("fault", faultHandler);
      }

      public function loadHandler(event:LoadEvent):void {
      Alert.show("WSDL is loaded");
      WS.addnumbers(2,5);
      }

      public function resultHandler(event:ResultEvent):void {
      Alert.show("in result handler");
      myTextArea.text = event.result.toString();
      }

      public function faultHandler(event:FaultEvent):void {
      Alert.show("fault: "+ event.toString());
      }
      ---------------------

      My WSDL:
      --------------------
      <?xml version="1.0" encoding="UTF-8"?><definitions xmlns=" http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:TestWebservice/wsdl" xmlns:ns2="urn:TestWebservice/types" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/" name="TestWebservice" targetNamespace="urn:TestWebservice/wsdl">
      <types>
      <schema xmlns=" http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:TestWebservice/types" xmlns:soap11-enc=" http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:TestWebservice/types">
      <complexType name="addnumbers">
      <sequence>
      <element name="int_1" type="int"/>
      <element name="int_2" type="int"/></sequence></complexType>
      <complexType name="addnumbersResponse">
      <sequence>

      <element name="result" type="int"/></sequence></complexType>
      <element name="addnumbers" type="tns:addnumbers"/>
      <element name="addnumbersResponse" type="tns:addnumbersResponse"/></schema></types>
      <message name="TestWebserviceSEI_addnumbers">
      <part name="parameters" element="ns2:addnumbers"/></message>
      <message name="TestWebserviceSEI_addnumbersResponse">
      <part name="result" element="ns2:addnumbersResponse"/></message>
      <portType name="TestWebserviceSEI">
      <operation name="addnumbers">

      <input message="tns:TestWebserviceSEI_addnumbers"/>
      <output message="tns:TestWebserviceSEI_addnumbersResponse"/></operation></portType>
      <binding name="TestWebserviceSEIBinding" type="tns:TestWebserviceSEI">
      <soap:binding transport=" http://schemas.xmlsoap.org/soap/http" style="document"/>
      <operation name="addnumbers">
      <soap:operation soapAction=""/>
      <input>
      <soap:body use="literal"/></input>
      <output>

      <soap:body use="literal"/></output></operation></binding>
      <service name="TestWebservice">
      <port name="TestWebserviceSEIPort" binding="tns:TestWebserviceSEIBinding">
      <soap:address location=" http://................../FlexWebserviceTest2/TestWebservice" xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/" xmlns:soap12=" http://schemas.xmlsoap.org/wsdl/soap12/"/></port></service></definitions>
      --------------------