Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services Experiences Machiel Jansen Vrije Universiteit (VU) Amsterdam.

Similar presentations


Presentation on theme: "Web Services Experiences Machiel Jansen Vrije Universiteit (VU) Amsterdam."— Presentation transcript:

1 Web Services Experiences Machiel Jansen Vrije Universiteit (VU) Amsterdam

2 Building web services in Java Prior Experience: none. Using NetBeans IDE: Making Webservives on the fly IDE generates stubs and hooks Provides container and servlets

3 Pro’s and cons- SUN Pro’s: No need to write WSDL Write application and ”publish” it as webservice. Cons: Sun webservices want the Sun Application Server – not in GT4.

4 Apache Axis Axis can be easy. Deploy your webservice rapidly (jws): All public methods are available All public methods are available But: Not configurable But: Not configurable Keep to global return datatypes Keep to global return datatypes

5 Apache Axis Two approaches: Start building application, or class library. Let Axis generate WSDL (?wsdl) Write WSDL Use WSDL2Java to generate stubs (clients) Use WSDL2Java to generate stubs (clients) and hooks (services) and hooks (services)

6 Axis server side

7 More difficult side of WS Serialize your datastructures: Easy when you stick to: Global types (int, double, String, array etc.) Java beans (set and get methods) Otherwise: write custom serializers.

8 Wrapping existing application Execute application from Java. (use runTime) Redirect the output. Deploy as webservice.

9 Wrapping existing application public int run(String cmd, Writer out) throws IOException { RunTime r = Runtime.getRuntime(); Process p = r.exec(cmd); FileIO.copyFile(new InputStreamReader(p.getInputStream( )), out, true); FileIO.copyFile(new InputStreamReader(p.getInputStream( )), out, true); try { p.waitFor( ); // wait for process to complete } catch (InterruptedException e) { } catch (InterruptedException e) { return -1; } return -1; } return p.exitValue( ); return p.exitValue( ); }

10 WS Clients – 3 types Stub based (easy: use WSDL2Java ) Service endpoint is static Dynamic proxy Service endpoint dynamically at runtime Service endpoint dynamically at runtime Dynamic Invocation Interface (DII) Discover services at runtime then invoke methods Discover services at runtime then invoke methods

11 Clients - DII Axis user guide uses Call object (DII) in examples. WSRF and GT4 examples uses stubs.

12 I used a DII client – should you? DYNAMIC BUT HARDER THAN STUBS // Register your (un)serializer call.registerTypeMapping(Result.class, qm, new org.apache.axis.encoding.ser.BeanSerializerFactory(Result.class, qm), new org.apache.axis.encoding.ser.BeanDeserializerFactory(Result.class, qm)); new org.apache.axis.encoding.ser.BeanDeserializerFactory(Result.class, qm)); call.registerTypeMapping(Result[].class, ar, call.registerTypeMapping(Result[].class, ar, new org.apache.axis.encoding.ser.ArraySerializerFactory(), new org.apache.axis.encoding.ser.ArraySerializerFactory(), new org.apache.axis.encoding.ser.ArrayDeserializerFactory()); new org.apache.axis.encoding.ser.ArrayDeserializerFactory());

13 WSRF and GT4 Working on it. You can work with GT4: use the WSCore library. http://www-128.ibm.com/developerworks/edu/gr-dw-gr-eclipseide-i.html Note: GT4 WSRF is a little different from Apache WSRF GT4 uses GAR files and JNDI deployment. GT4 uses GAR files and JNDI deployment. Eclipse has a GT4 plugin…

14 What we would have liked… INDEXER/ SEARCHER CLIENT NODE Use Resource aware WS’s on different nodes to process indexes and search queries WS on some nodes. Use SRB or local storage. user and system resources.

15 What we would like – part 2 Scenario taken from: Building a grid using Web services standards. http://www-128.ibm.com/developerworks/edu/gr-dw-gr-movie1- i.html?S_TACT=105AGX07&S_CMP=HP

16 Questions How do we make good use of GT4 – the WS enabled part? How do we get access to GT4? How are WS’s (best) used in PoC infrastructure? Why use WS’s at all? Why can’t we use a WS outside the PoC? Does it matter? Technical hurdles still to take: More experience in WSRF More experience in WSRF Writing (de)serializers for custom datatypes. Writing (de)serializers for custom datatypes.


Download ppt "Web Services Experiences Machiel Jansen Vrije Universiteit (VU) Amsterdam."

Similar presentations


Ads by Google