0 Replies Latest reply on Aug 24, 2011 5:06 PM by nunnap2011

    Flash Builder 4.5 SOAP call for images using Base64 Encoding

    nunnap2011

      I am trying to load some image meta data in a flash builder mobile application by making a SOAP call to .Net service. I am able to test the web service successfully using a .Net console application. However when I make the call from flash builder mobile client I get a null result. What am I doing wrong? I am using SOAP 1.1 ByteArray didn't work for Flash builder. So converted the ByteArray to Base64 format and tried to obtain result that way. Both ways worked from a .Net Client but not working from Flash mobile.

       

       

      Here is the code

       

      <fx:Script>
              <![CDATA[          
                  import mx.graphics.ImageSnapshot;
                  import mx.graphics.codec.JPEGEncoder;
                  import mx.graphics.codec.PNGEncoder;
                  import mx.rpc.AsyncToken;
                  import mx.utils.Base64Encoder;         
                  import services.exifimagemetadata1.ExifImageMetaData1;         
                  import spark.components.Image;     

                  public var metaData:ExifImageMetaData1 = new ExifImageMetaData1();         
                  public var imageBytes:ByteArray = new ByteArray();
                  public var gpsData:String;
          private function getBase64EncodedImage():String
                  {
                      var myEncoder:Base64Encoder = new Base64Encoder();
                      myEncoder.encodeBytes(getImageBytes());            
                      var image64BitText:String = myEncoder.toString();                          
                      return image64BitText;
                  }
          public function GetMetaDataFromExif():void{

                      var imageToken:AsyncToken = metaData.GetExifBase64Data(getBase64EncodedImage());               
                      gpsData = imageToken.result.toString();
                      metaResult.text = gpsData;
                  }

          protected function GetImageMetaDataFromExif(event:MouseEvent):void
                  {
                      GetMetaDataFromExif();         
                  }

              ]]>
         
      </fx:Script>
      <s:layout>
             
      <s:VerticalLayout>         
             
      </s:VerticalLayout>
         
      </s:layout>
         
      <s:HGroup>
             
      <s:Image id="test" width="130" height="140" source="@Embed(source='assets/p1000106.jpg')"/>
         
      </s:HGroup>
         
      <s:HGroup>
         
      <s:Label width="100" height="140" backgroundColor="Blue" click="GetImageMetaDataFromExif(event)">
             
      <s:text/>
         
      </s:Label>
         
      </s:HGroup>
         
      <s:HGroup>
             
      <s:Label id="metaResult" width="200" height="140" backgroundColor="yellow"/>           
         
      </s:HGroup>