iPhone meets SOA - 06/2008

17
Use FUSE to accelerate iPhone Web Development FUSE Master Class Series Roland Tritsch Director Services EMEA [email protected]

Transcript of iPhone meets SOA - 06/2008

Page 1: iPhone meets SOA - 06/2008

1

Use FUSE to accelerateiPhone Web DevelopmentFUSE Master Class Series

Roland TritschDirector Services [email protected]

Page 2: iPhone meets SOA - 06/2008

© 2008 IONA Technologies2

Introduction

This session will show you how to use FUSE to access SOAP/HTTP WebServices from the iPhone

The code we are using in this session is available from the IONA FUSE demo/download area open.iona.com

The main target audience for this session are Architects and Developers that want to build iPhone applications that integrate with the web

Page 3: iPhone meets SOA - 06/2008

© 2008 IONA Technologies3

Agenda

Why is this important/relevant?

Understanding the solutionShow the code - before and after

Understanding the demo!The service interface

The client side implementation

The Software Development Environment

Summary

Page 4: iPhone meets SOA - 06/2008

© 2008 IONA Technologies4

Why is this important/relevant?

With the new iPhone SDK you can implement applications using Objective-C or AJAX (XHTML, JavaScript, CSS)‏

The AJAX environment is quite powerful, but writing all the code to send/receive (marshal/unmarshal) data using XmlHttpRequest is extremly tedious and errorprone

How cool would it be, if you could use a wsdl2js or java2js compiler to generate a complete SOAP/HTTP client side stack for a given service and invoke on the operations of the service with a simple request-response interface?

Hint: This stack would obviously still use XmlHttpRequest under the hood, but this would not bother you anymore. Plus all of the marshaling code is generated.

Page 5: iPhone meets SOA - 06/2008

© 2008 IONA Technologies5

The Service Interface

<...>

<wsdl:operation name="sayHi">

<soap:operation soapAction="" style="document"/>

<wsdl:input name="sayHiRequest">

<soap:body use="literal"/>

</wsdl:input>

<wsdl:output name="sayHiResponse">

<soap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

<...>

Page 6: iPhone meets SOA - 06/2008

© 2008 IONA Technologies6

“Before” code

function onClickSayHi() {

var xmlHttpRequest = GetXmlHttpRequestObject();

// setup anonymous callback function to deal with response

xmlHttp.onreadystatechange = function() {

if(xmlHttp.readyState != 4) return;

// LOTS of unmarshaling code goes here

}

// LOTS of marshaling code goes here

xmlHttp.open("GET", url, true);

xmlHttp.send(null);

}

Page 7: iPhone meets SOA - 06/2008

© 2008 IONA Technologies7

“After” code :)‏

function onSuccess(response) {

var text = response.getResponseType();

}

function onError(error) {

alert(error);

}

function onClickSayHi() {

var service = GetGreeterService();

service.sayHi(onSuccess, onError);

}

Page 8: iPhone meets SOA - 06/2008

© 2008 IONA Technologies8

How to generate the code ‏

Use wsdl2js or java2js to generate the code upfront

OR (even better) use the ...?js URL handler to generate the javascript on the fly

WANNA SEE ???

Page 9: iPhone meets SOA - 06/2008

© 2008 IONA Technologies9

Demo

Page 10: iPhone meets SOA - 06/2008

© 2008 IONA Technologies10

Demo

Page 11: iPhone meets SOA - 06/2008

© 2008 IONA Technologies11

Demo

Page 12: iPhone meets SOA - 06/2008

© 2008 IONA Technologies12

Demo

Page 13: iPhone meets SOA - 06/2008

© 2008 IONA Technologies13

The Software Development Environment

You can use what ever you want to develop the GUI

Dashcode, Eclipse, GWTK, EMACS :)‏

Latest version of Apache CXFBuild it from the TRUNK or use one of the nightly builds

Or download the next version of FUSE that will become available mid of May.

iPhone simulatorUse either the one that comes with the iPhone SDK or (if you are still on 10.4) the iPhoney simulator

Windows users can download Safari 3 for Windows

Debugging

Dashcode, Drosera, (Firebug) ‏

Page 14: iPhone meets SOA - 06/2008

© 2008 IONA Technologies14

Summary

We have shown you some powerful JavaScript generation capabilities which can accelerate your Web-Development efforts dramatically

This is especially relevant, if you want to write Web-Applications for the iPhone

Check it out :)‏The latest version of Apache CXF supports it right now (2.1) ‏

A supported version of the feature will become available through the FUSE Service Framework release in May 2008

The demo code that we used in this session is available on open.iona.com

Page 15: iPhone meets SOA - 06/2008

© 2008 IONA Technologies15

Resources

Download FUSE: http://open.iona.com/downloads

Apache CXF: http://incubator.apache.org/cxf/

iPhoney: http://www.marketcircle.com/iphoney/

Apple SDK: http://developer.apple.com/iphone/program/

Any questions?EMail me: [email protected]

Page 16: iPhone meets SOA - 06/2008

© 2008 IONA Technologies16

What next?

Join the community at open.iona.com

Learn about IONA’s training, consultancy & support offerings

Page 17: iPhone meets SOA - 06/2008

17

Use FUSE to accelerateiPhone Web DevelopmentFUSE Master Class Series

Roland TritschDirector Services [email protected]