1 Reply Latest reply on Jul 25, 2010 9:22 PM by Flex harUI

    Flex 3 Webservice Request (setting value in the request from text field)

    Magicrman

      Hi to All,

       

      I have basic web service and I’m having problems sending proper  request. If I send only text in the elements on the request the call is  successful, but if I try to get value from text field and send in the  request the value isn’t sent.

       

      I’m not sure why this is happening.

       

       

      Here is the code:

       

       import mx.rpc.events.ResultEvent;

      private function responseData(e:ResultEvent):void {
          trace
      (XML(e.result));
          trace
      (XML(e.result).*::a);
      }

      <mx:WebService id="userRequest" wsdl="WSDL.wsdl">
         
      <mx:operation name="Login"
           fault
      ="mx.controls.Alert.show(event.fault.faultString)"
           result
      ="responseData(event)" resultFormat="xml">
             
      <mx:request format="xml" xmlns="http://www.test.com/schemas/Test/Schema.xsd">
                     
      <root>
                         
      <a>{temp.text}</a>
                         
      <a>3</a>
                          <b>
                              <c>1</
      c>
                             
      <d>2</d>
                          </
      b>
                     
      </root>
              </
      mx:request>
         
      </mx:operation>
      </
      mx:WebService>

      <mx:TextInput x="10" y="10" id="temp"/>
      <mx:Button x="178" y="10" label="Button" click="{userRequest.Login.send();}"/>

       

      And here is the request that is sent:

       

      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
         
      <root xmlns="http://www.test.com/schemas/Test/Schema.xsd">
             
      <a/>
             
      <a>3</a>
             
      <b>
                 
      <c>1</c>
                 
      <d>2</d>
             
      </b>
         
      </root>
      </SOAP-ENV:Body>

       

      Any suggestions?

       

      Thanks