0 Replies Latest reply on May 7, 2010 6:28 AM by _H_P_

    Web Service

    _H_P_

      Hello,

       

      I am trying to access a service, but I am unable to figure out where I may be going wrong.I am using Flex 3. When I debug the "res" variable equals null and it doesnot provide me with any output.

       

      Please help.

       

      Thanks.

      -H

       

      <definitions targetNamespace="http://model/" name="EchoService">
      −
      <wsp:Policy wsu:Id="EchoBeanPortBinding_printEcho_WSAT_Policy">
      <wsat:ATAlwaysCapability/>
      <wsat:ATAssertion wsp:Optional="true" ns1:Optional="true"/>
      </wsp:Policy>
      −
      <types>
      −
      <xsd:schema>
      <xsd:import namespace="http://model/" schemaLocation="http://192.168.10.203:8080/EchoService/EchoBean?xsd=1"/>
      </xsd:schema>
      </types>
      −
      <message name="printEcho">
      <part name="parameters" element="tns:printEcho"/>
      </message>
      −
      <message name="printEchoResponse">
      <part name="parameters" element="tns:printEchoResponse"/>
      </message>
      −
      <portType name="EchoBean">
      −
      <operation name="printEcho">
      <input wsam:Action="http://model/EchoBean/printEchoRequest" message="tns:printEcho"/>
      <output wsam:Action="http://model/EchoBean/printEchoResponse" message="tns:printEchoResponse"/>
      </operation>
      </portType>
      −
      <binding name="EchoBeanPortBinding" type="tns:EchoBean">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
      −
      <operation name="printEcho">
      <wsp:PolicyReference URI="#EchoBeanPortBinding_printEcho_WSAT_Policy"/>
      <soap:operation soapAction=""/>
      −
      <input>
      <wsp:PolicyReference URI="#EchoBeanPortBinding_printEcho_WSAT_Policy"/>
      <soap:body use="literal"/>
      </input>
      −
      <output>
      <wsp:PolicyReference URI="#EchoBeanPortBinding_printEcho_WSAT_Policy"/>
      <soap:body use="literal"/>
      </output>
      </operation>
      </binding>
      −
      <service name="EchoService">
      −
      <port name="EchoBeanPort" binding="tns:EchoBeanPortBinding">
      <soap:address location="http://192.168.10.203:8080/EchoService/EchoBean"/>
      </port>
      </service>
      </definitions>
      

       

      Flex code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
          <![CDATA[
              import mx.rpc.events.FaultEvent;
              import mx.rpc.events.ResultEvent;
              [Bindable]
              public var echoResult:String;
              public function echoService_resultHandler(event:ResultEvent):void{
                   res= echoService.printEcho.lastResult;
              }
              public function echoService_faultHandler(event:FaultEvent):void{
                  
              }
          ]]>
      </mx:Script>
          <mx:Form x="101" y="110" width="241" height="129">
              <mx:FormItem label="Echo" fontSize="15" id ="echoForm">
                  <mx:Text width="100%" height="25" id ="echoText"
                     text = "{res}"/>
              </mx:FormItem>
          </mx:Form>
          
          <mx:WebService id= "echoService"
              wsdl="http://192.168.10.203:8080/EchoService/EchoBean?wsdl">
              <mx:operation name ="printEcho" 
                  result = "echoService_resultHandler(event)"
                  fault="echoService_faultHandler(event)"/>
          </mx:WebService>
      </mx:Application>
      
      

       

      -H