iphone meets soa - 06/2008

Post on 07-Jul-2015

236 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Use FUSE to accelerateiPhone Web DevelopmentFUSE Master Class Series

Roland TritschDirector Services EMEAroland.tritsch@iona.com

© 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

© 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

© 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.

© 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>

<...>

© 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);

}

© 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);

}

© 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 ???

© 2008 IONA Technologies9

Demo

© 2008 IONA Technologies10

Demo

© 2008 IONA Technologies11

Demo

© 2008 IONA Technologies12

Demo

© 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) ‏

© 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

© 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: roland.tritsch@iona.com

© 2008 IONA Technologies16

What next?

Join the community at open.iona.com

Learn about IONA’s training, consultancy & support offerings

17

Use FUSE to accelerateiPhone Web DevelopmentFUSE Master Class Series

Roland TritschDirector Services EMEAroland.tritsch@iona.com

top related