2 Replies Latest reply on Jul 26, 2010 1:31 PM by AICC

    HOT TO INTEGRATE, WCF flex 4 data services

    AICC Level 1

      OK.  I am trying to build a simple HELLO WORLD WCF Sample and use FLEX 4 (new data servic

      es wizard to invoke it).

       

       

      I have the WCF Client

      Tested the WCF Client  (works great with JQUERY)

       

      Now I have a brand new flex project and was able

      to click the "DATA/SERVICES" and establish a good relationship to the wsdl

      http://llocalhost/service.svc?wsdl

       

      Flex 4 finds the service and the correct methods.

       

      WHEN IT TEST IT OUT using the "TEST OPERATION" panel..it fails with a very ugly error.

      a:InternalServiceFaultError in deserializing body of request message for

      operation 'HelloWorld'. OperationFormatter encountered an invalid Message

      body. Expected to find node type 'Element' with name 'HelloWorld' and

      namespace 'http://localhost'. Found node type 'Element' with name

      'q0:HelloWorld' and namespace 'http://tempuri.org/'OperationFormatter

      encountered an invalid Message body. Expected to find node type 'Element'

      with name 'HelloWorld' and namespace 'http://localhost'.  .........

       

       

      I also decided to try and test invoking it from a mxml file

       

      NOTHING HAPPENS AT ALL..OR IT GET NULL OR OTHER ERRORS

       

      <s:Application

       

       

      xmlns:testWcFWebServices="services.service.*"

       

       

       

      protected function helloWorld():void

      {

       

      //Alert.Show(ServiceTest.HelloWorld().result);

      HelloWorldResult.token = ServiceTest.HelloWorld();

      Alert.show(HelloWorldResult.lastResult);

      }

       

       

      <fx:Declarations>

       

      <s:CallResponder id="HelloWorldResult"/>

       

      <testWcFWebServices:Service id="ServiceTest" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>

       

      </fx:Declarations>

      </fx:Declarations>

       

       

      PLEASE HELP...this is very disturbing when trying to figure this out.

       

       

      search:
      flex 4 CallResponder wcf wsdl hello world
      flex 4  wcf wsdl data services
      flex 4  wcf wsdl data services 2010
      flex 4  wsdl data services wizard
      flex 4 web service hello world example
      flex 4 data services web service hello world example
      flex 4 data services hello world example
      flex 4 data services example
      flex4 wcf
      flex InternalServiceFaultError in deserializing body of request message for
      flex services InvocationTargetException

        • 1. Re: HOT TO INTEGRATE, WCF flex 4 data services
          AICC Level 1

          OK I Finally got the TEST OPERATION WINDOW return

          ing XML /SOAP

           

          <?xml version="1.0" encoding="UTF-8"?>
          <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
            <s:Body>
              <CallHelloWorldResponse xmlns="http://tempuri.org/">
                <CallHelloWorldResult>HELLO WORLD 20100726_218pm</CallHelloWorldResult>
              </CallHelloWorldResponse>
            </s:Body>
          </s:Envelope>

           

          NOW How can I retrieve "HELLO WORLD 20100726_218pm" using the Call Responder

           

          THIS DOES NOT WORK:

          myHelloWorldResult.token = ServiceTest.CallHelloWorld();
          Alert.show(myHelloWorldResult.lastResult );

           

           

           

           

           

          thanks,

           

          Doug Lubey of Louisiana

          www.douglubey.com

           

           

           

          SEARCH ENGINE REFEFENCE:

          flex 4 data services s:CallResponder
          flex 4 data services s:CallResponder lastresult
          flex 4 data services s:CallResponder lastresult convert to string
          flex 4 data services s:CallResponder return string data
          flex 4 data services s:CallResponder returns string

          • 2. Re: HOT TO INTEGRATE, WCF flex 4 data services
            AICC Level 1

            Holy cow???? it finally came through....It really should not be that Hard.  I should be able to right click the "DATA/SERVICES" icon and it generate a MXML action script file on how to consume it...

             

            IF JUST WORKING WITH a simple Data Type:

             

            DO NOT NEED TO work with a

            <s:CallResponder id="myHelloWorldResult"/>

             

             

            JUST SIMPLE CREATE A RESULT EVENT IN THE DECLARATION:

             

              <testWcFWebServices:MyHelloWorld id="ServiceTest" result="ServiceTest_resultHandler(event)" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>

             

            protected function ServiceTest_resultHandler(event:ResultEvent):void
            {
            showResult(event.result.toString());
            }
              
            private function showResult(reqResult:String):void {
            Alert.show(reqResult);
            }

             

             

            TO NOTE: I DID USE THIS SAMPLE AS I GUIDE: Even though this guy used action script...and I wanted to use the DATA\SERVICES wizard.

            http://cookbooks.adobe.com/post_Connecting_Flex_4_with_WCF_Services-17006.html