flex360 milan 2008 - flex & webservices

23
pyright 2008 Adobe Systems Incorporated. All rights reserved. Flex 3 & Webservices Cristian Ivascu :: Adobe 360 Flex, Milan 08 – APR - 2008 1

Upload: ivascucristian

Post on 18-Nov-2014

120 views

Category:

Technology


2 download

DESCRIPTION

The presentation on Flex Builder's integration with SOAP webservices. Presented in 2008 at Flex360 Milan

TRANSCRIPT

Page 1: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Flex 3 & Webservices

Cristian Ivascu :: Adobe360 Flex, Milan08 – APR - 2008

1

Page 2: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Agenda

Introduction to Flex and web services Building a SOAP-based app REST services Building a del.icio.us based app Q&A

2

Page 3: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

One server, multiple, disparate clients

3

Page 4: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

What are webservices?

Practice matters!

4

W3C says: “a software system designed to support interoperable Machine to Machine interaction over a network” (W3C)

In practice:web apis that are accessed remotely

Page 5: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Web services – which one?

SOAP & WSDL Machine usable Verbose Enterprise

REST Light-weight No encoding popular!

5

Page 6: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Flex and Webservices

Flex creates rich clients; Web services bring data to the client Flex works with web services in an easy

manner

6

Page 7: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

WSDL sample - VideoSearch

• Only one operation• Simple request parameters• Slightly complex response

• Link: http://localhost/video.wsdl

7

Page 8: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved. 8

How to access the service?

At runtime At development time (via tool support)

Page 9: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved. 9

Runtime Demo

Let’s see it in the Builder!

Page 10: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

When to use it• Dynamic scenarios• Discovery of services at run-time• Services that may change more often

Characteristics• Not tied to a particular implementation• Very flexible• Adapts easily to changes, without messing with the code

10

Page 11: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

What about this?

11

Page 12: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Dev-time way

Why?• For the more static scenarios – build and forget• For increased productivity• To make it easier

How?• Added classes to model the wsdl contents• Added a way to link types in wsdl to AS classes• Tool support & code generation

12

Page 13: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved. 13

Video Search Demo redone

The same Video Searching app re-done to take advantage of the new features.,

Let’s see how it’s made.

Page 14: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Generated code – is this spaghetti?

14

Page 15: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

How to find and fix problems

Check if the schema is there Breakpoints in call() and processResult() Check type mappings & wsdl type

15

Page 16: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Known issues with the generated code

We don’t support everything – only WS-I 1.0 profile; wsdl 1.0 & soap 1.1

Known issues – there are a few Have one? Report it @ bugs.adobe.com/flex

16

Page 17: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

REST

Can use multiple output formats – XML, JSON, etc

Is very light-weight Pro: performance Con: there is no typing info!

Is very popular

17

Page 18: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Flex & Rest services

They haven’t change much AS allows manipulation of XML and binding to objects But there’s a catch – httpservice.xmlDecode() + a custom

model

18

Page 19: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

DEMO – del.icio.us API usage

xmlDecode to convert raw xml into an array of “Post.as” instances

There is also a more generic approach – using SimpleXMLDecoder & ObjectTranslator

http://booleanbetrayal.com/2007/05/18/httpservice-xmldecode-objecttranslator-and-rabidsquirrels/

19

Page 20: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Flex | Final words of wisdom

Web services are a way of getting data into your Flex app; When building rich clients you need to use them Web services in Flex can be better; for suggestions or bugs

visit: bugs.adobe.com/flex

20

Page 21: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Q & A

21

Page 22: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

• Flex can cope with both dynamic and strong-typed web service usage.• The wizard only generates some code for you. Tweak it!• Strong types are not for WSDL only. Use XMLDecode() .

This is (almost) the last slide

22

Page 23: Flex360 Milan 2008 - Flex & Webservices

Copyright 2008 Adobe Systems Incorporated. All rights reserved.

Go play!

http://adobe.com/go/flex

…and off to lunch! Buon appetito!

23