Bienvenido a Klr20mg

Cronicas de un desarrollador

Actualmente soy Jefe de Desarrollo del area Flash en Sapotek de México en la cual trabajo desde hace mas de 4 años. Desarrollando aplicaciones en Flash para Web mas comúnmente llamadas (RIAs)

Estas en : Blog » [Flex 2.0] TraceTarget
  • Decrease font size
  • Default font size
  • Increase font size
  • color default
  • color verde
  • color azul
[Flex 2.0] TraceTarget
AddThis Social Bookmark Button
Post2PDF Print
October 2nd, 2006

Últimamente he estado probando Flex. Estoy realizando una vista en Flex de este blog que pronto podrán ver en linea entre otras cosas..

Bien, El tema de hoy va sobre la etiqueta esta etiqueta al momento de debuguear tu aplicación es de gran ayuda, por ejemplo, digamos que queremos consumir un webServices remoto, algo simple tomar la “Cita del día”.

Cuando agregamos esta etiqueta a nuestro mxml regresa una secuencia detallada de los eventos que se están ejecutando en nuestra aplicación. Como es un tag para debuguear en nuestra aplicación final no se vera ningún cambio.

El ejemplo es sencillo

Actionscript:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="350" height="100" applicationComplete="init()">
  3.     <mx:Script>
  4.         <![CDATA[
  5.             import mx.events.*
  6.             import flash.xml.XMLDocument
  7.             public function init():void
  8.             {
  9.                 miConexion.GetQuote.send()
  10.             }
  11.             public function onResultOK(event:Event):void
  12.             {
  13.                 var data:XMLDocument = new XMLDocument();
  14.                 data.parseXML(miConexion.GetQuote.lastResult);
  15.                 var out:String = data.firstChild.firstChild.firstChild.firstChild.nodeValue
  16.                 outPut.text = out
  17.                
  18.             }
  19.             public function onResultFault(fault:Event):void
  20.             {
  21.                 trace(fault)
  22.             }
  23.         ]]>
  24.     </mx:Script>
  25.     <mx:TraceTarget />
  26.     <mx:WebService  wsdl="http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx?WSDL" id="miConexion">
  27.         <mx:operation name="GetQuote" result="onResultOK(event)" fault="onResultFault(event)" resultFormat="xml" makeObjectsBindable="true"/>
  28.     </mx:WebService>
  29.     <mx:Text x="10" y="10" width="330" height="80" id="outPut" text="Cargando Data Externa"/>
  30. </mx:Application>

así es como se ve nuestra ventana de debugeo si dicha etiqueta

Actionscript:
  1. [SWF] C:\Documents and Settings\Tmeist3r\Desktop\test\bin\test-debug.swf - 730,596 bytes after decompression

Ahora, así es como se ve nuestra ventana de debugueo cuando utilizamos TraceTarget

Actionscript:
  1. [SWF] C:\Documents and Settings\Tmeist3r\Desktop\test\bin\test-debug.swf - 717,747 bytes after decompression
  2. Registering schema namespace: http://www.w3.org/1999/XMLSchema
  3. Registering schema namespace: http://www.w3.org/2000/10/XMLSchema
  4. Registering schema namespace: http://www.w3.org/2001/XMLSchema
  5. Registering schema namespace: http://schemas.xmlsoap.org/soap/encoding/
  6. Registering schema namespace: http://xml.apache.org/xml-soap
  7. Registering schema namespace: http://rpc.xml.coldfusion
  8. '0E6C71D7-0670-186D-74DB-0B47A9E33F2A' producer set destination to 'DefaultHTTP'.
  9. '9828CAB5-C669-81AC-3299-0B47AA9F2817' producer set destination to 'DefaultHTTP'.
  10. 'direct_http_channel' channel endpoint set to http:
  11. Creating WSDL object for http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx?WSDL
  12. '127766B4-8379-1647-CADD-0B47AA9FB309' producer set destination to 'DefaultHTTP'.
  13. Loading document http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx?WSDL for destination 'DefaultHTTP'
  14. '0E6C71D7-0670-186D-74DB-0B47A9E33F2A' producer sending message '5604ADC7-4155-F995-8E77-0B47AA9F7C90'
  15. 'direct_http_channel' channel sending message:
  16. (mx.messaging.messages::HTTPRequestMessage)#0
  17.   body = (Object)#1
  18.   clientId = (null)
  19.   contentType = "application/x-www-form-urlencoded"
  20.   destination = "DefaultHTTP"
  21.   headers = (Object)#2
  22.   httpHeaders = (Object)#3
  23.   messageId = "5604ADC7-4155-F995-8E77-0B47AA9F7C90"
  24.   method = "GET"
  25.   recordHeaders = false
  26.   timestamp = 0
  27.   timeToLive = 0
  28.   url = "http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx?WSDL"
  29. '0E6C71D7-0670-186D-74DB-0B47A9E33F2A' producer connected.
  30. Queueing SOAP operation GetQuote
  31. '0E6C71D7-0670-186D-74DB-0B47A9E33F2A' producer acknowledge of '5604ADC7-4155-F995-8E77-0B47AA9F7C90'.
  32. Processing imports for location http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx?WSDL
  33. Parsing schemas
  34. Registering schema namespace: http://swanandmokashi.com
  35. Done parsing schemas: 3 ms
  36. Done processing imports: 581 ms
  37. Parsing services
  38. Parsing individual services
  39. Parsing service: QuoteofTheDay
  40. Parsing binding: http://swanandmokashi.com::QuoteofTheDaySoap
  41. Parsing portType: http://swanandmokashi.com::QuoteofTheDaySoap
  42. Parsed portType: 1 ms
  43. Parsed binding: 6 ms
  44. Parsed service: 11 ms
  45. Done parsing services: 12 ms
  46. WSDL parse took 594 ms
  47. WSDL loaded
  48. Made SOAP Operation for GetQuote
  49. Set active port in service stub: QuoteofTheDay:QuoteofTheDaySoap
  50. Invoking previously queued calls GetQuote
  51. Invoking SOAP operation GetQuote
  52. Initializing SOAP operation GetQuote
  53. Parsing message: http://swanandmokashi.com::GetQuoteSoapIn
  54. Message name is GetQuoteSoapIn
  55. Parsed message: 5 ms
  56. Parsing message: http://swanandmokashi.com::GetQuoteSoapOut
  57. Message name is GetQuoteSoapOut
  58. Parsed message: 5 ms
  59. Asynchronously invoking SOAP Operation: GetQuote
  60. Encoding SOAP request envelope
  61. Encoding SOAP request body
  62. Encoded SOAP Operation request: <?xml version="1.0" encoding="utf-8"?>
  63. <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><GetQuote xmlns="http://swanandmokashi.com" /></SOAP-ENV:Body></SOAP-ENV:Envelope>
  64. '0E6C71D7-0670-186D-74DB-0B47A9E33F2A' producer sending message 'E5E1E227-8114-3417-14DB-0B47AD103D57'
  65. 'direct_http_channel' channel sending message:
  66. (mx.messaging.messages::SOAPMessage)#0
  67.   body = "<?xml version="1.0" encoding="utf-8"?>
  68. <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><GetQuote xmlns="http://swanandmokashi.com" /></SOAP-ENV:Body></SOAP-ENV:Envelope>"
  69.   clientId = "DirectHTTPChannel0"
  70.   contentType = "text/xml; charset=utf-8"
  71.   destination = "DefaultHTTP"
  72.   headers = (Object)#1
  73.   httpHeaders = (Object)#2
  74.     SOAPAction = ""http://swanandmokashi.com/GetQuote""
  75.   messageId = "E5E1E227-8114-3417-14DB-0B47AD103D57"
  76.   method = "POST"
  77.   recordHeaders = false
  78.   timestamp = 0
  79.   timeToLive = 0
  80.   url = "http://www.swanandmokashi.com/HomePage/WebServices/QuoteOfTheDay.asmx"
  81. '0E6C71D7-0670-186D-74DB-0B47A9E33F2A' producer acknowledge of 'E5E1E227-8114-3417-14DB-0B47AD103D57'.
  82. Decoding SOAP response
  83. Encoded SOAP response: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><GetQuoteResponse xmlns="http://swanandmokashi.com"><GetQuoteResult><QuoteOfTheDay>All I Really Need To Know I Learned In Kindergarten</QuoteOfTheDay><Author>Robert Fulghum</Author></GetQuoteResult></GetQuoteResponse></soap:Body></soap:Envelope>
  84. Decoding SOAP response envelope
  85. Decoded SOAP response into result [0 millis]

Sin duda esta es una etiqueta que nos puede ahorrar muchos dolores de cabeza al momento de Debugear.

Saludos!!

Comentarios

Un Comentario en “[Flex 2.0] TraceTarget”

Definitivamente buena forma para debuguear usar el TraceTarget. Adicionalmente yo recomendaría usar algún Web Debug externo. Son útiles para evitar horas de sufrimiento. Un ejemplo es el Charles Web Debug que nos permite ver exactamente lo que el servidor Web, le envía a Flex.

saludos

Dano escribio el 11-November-2006 a las 11:56 am

Leave a Reply

 Blog editado por:

Enrique Chavez aka Tmeister
Si los codigos de este sitio te han ayudado y gustas ayudar de alguna forma:

 Compra Links

 Suscribete


AddThis Social Bookmark Button

 Archivo

2008
2007
2006
2005
2004