Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Grid Web Services and Gateway PTLIU Laboratory for Community Grids Marlon Pierce, Choonhan Youn, Geoffrey Fox, Computer Science, Informatics, Physics.

Similar presentations


Presentation on theme: "1 Grid Web Services and Gateway PTLIU Laboratory for Community Grids Marlon Pierce, Choonhan Youn, Geoffrey Fox, Computer Science, Informatics, Physics."— Presentation transcript:

1 1 Grid Web Services and Gateway PTLIU Laboratory for Community Grids Marlon Pierce, Choonhan Youn, Geoffrey Fox, Computer Science, Informatics, Physics Indiana University, Bloomington IN 47404 http://grids.ucs.indiana.edu/ptliupages/publications/presentations/ggf4feb02 gcf@indiana.edu Part of GGF4 Tutorial Toronto February 17 2002 Grid Programming with Web Services, Software Components and Portal Development Tools

2 2 Web service parts WSDL: describes service SOAP: protocol for remote procedure calls between client and server UDDI: Service registry. –White pages, yellow pages, and green pages(?)

3 3 SOAP Client Connect and Use Service Discover Service from Registry Service Registry Server Register Service SOAP Server UDDI Repository of WSDL Interfaces

4 4 Tutorial Overview We’ll use batch script generation as our example web service. –This is an actual service developed by SDSC (Stephen Mock) and IU (Choonhan Youn and Marlon Pierce). Basic steps: –Develop SOAP service. –Write WSDL service interface. –Put service in UDDI.

5 5 Sample Web Service Generating batch scripts from user requests is a common task implemented by a several portals (including Gateway and HotPage). Stop reinventing this! Basics of the service: –An XML document using a DTD from SDSC is created by the client and sent to the server. –The server takes this input, generates a script for the requesting queuing system (PBS, GRD,…) and returns this to the client.

6 6 Developing SOAP Services A Java-centric look at deploying services and developing clients.

7 7 SOAP Basics SOAP is a W3C standard for describing remote procedure calls in XML. –See http://www.w3c.org/TR/SOAPhttp://www.w3c.org/TR/SOAP SOAP language bindings exist for Java, Python, Perl, …. –For Java, we use Apache SOAP 2.2 (being deprecated in favor of Apache Axis). –Java Classes correspond to SOAP tags. –Clients and services communicate with SOAP over HTTP behind the scenes. You can always roll your own SOAP messaging.

8 8 Developing a Service and Setting Up a SOAP Server Nothing special required to develop a particular service –It just needs to be a Java class. You need a Tomcat or similar server for handling servlets. Get the SOAP war file from Apache and drop into the webapps directory. –See http://xml.apache.org/soap/ for downloads and instructionshttp://xml.apache.org/soap/

9 9 Batch Script Generation Service We have a class called BatchScriptService.java. This has one public method, public String BatchGen(String xmlfile); For Gateway, we put this into the package WebFlowSoap. This is compiled and put in the Tomcat server’s classpath.

10 10 Deploying the Service Now make your service available from your SOAP server (Tomcat+SOAP war file). Write a deployment descriptor for the particular service (like batch script generation).

11 11 Example Deployment Descriptor for Batch Script Generator <isd:service xmlns:isd="http://xml.apache.org/xml- soap/deployment" id="urn:BatchScriptService" checkMustUnderstands="false"> <isd:provider type="java" scope="Application" methods="BatchGen"> <isd:java class="WebFlowSoap.BatchScriptService“ static="false"/>

12 12 Looking at the Descriptor Note this is specific to Apache SOAP. The Service ID is the name (URN) of your service (BatchScriptService). checkMustUnderstands corresponds to the “MustUnderstand” element of the SOAP header. Provider is the language of the service. Scope corresponds to JSP scope variables. Methods attribute is the method name. The class attribute of the java tag points to the compiled BatchScriptService.class file in the classpath. The static attribute is true if the class uses Java static methods.

13 13 Apache SOAP’s administration page, showing a list of deployed services.

14 14 Follow the “Deploy” link and you can fill out forms to generate a Deployment Descriptor.

15 15 HTML display of the Batch Script Generator’s Deployment Descriptor

16 16 SOAP Clients You can write SOAP clients to directly interact with deployed SOAP services –SOAP-RPC over HTTP Steps for writing a Java client: –Create a Call object and connect to the server. Specify the name (URN) of the service you want. –Create a Parameters object and pass the parameters required by the method. –Use Call object’s invoke() method for invoking the remote service. –Get the returned values from the method.

17 17 Example: Creating the Call //Import Apache SOAP packages import org.apache.soap.*; import org.apache.soap.rpc.*; //Do other stuff (omitted) // Build the call. Call call = new Call (); call.setTargetObjectURI ("urn:BatchScriptService"); call.setMethodName ("BatchGen"); call.setEncodingStyleURI(encodingStyleURI); Vector params = new Vector (); params.addElement (new Parameter("xmlFile",String.class,xmlFile,null)); call.setParams (params);

18 18 Example: Invoke the remote method //The url object below points to your Tomcat server’s rpc router Response resp = call.invoke (url,""); // Check the response. if (resp.generatedFault ()) { Fault fault = resp.getFault (); System.out.println ("Ouch, the call failed: "); System.out.println (" Fault Code = " + fault.getFaultCode ()); System.out.println (" Fault String = " + fault.getFaultString ()); } else { Parameter result = resp.getReturnValue (); System.out.println (result.getValue()); }

19 19 Next Steps Limitations of the SOAP client –You have to know where the server is and the services it provides (UDDI) –You have to know the service’s name, its methods, and the methods’ interfaces (WSDL). It would be nice to have wrappers for generating the SOAP client code for a particular sevice.

20 20 Using WSDL An overview of the Web Services Description Language

21 21 WSDL Overview WSDL is the W3C’s standard for describing method interfaces in XML. –See http://www.w3c.org/TR/wsdl.htmlhttp://www.w3c.org/TR/wsdl.html It is equivalent to CORBA’s Interface Definition Language (IDL), only in XML.

22 22 What WSDL Describes The name of the service (maps to a Java class). The service’s method names, arguments, and return types. WSDL is extended for specific carriers –For us, invoke using SOAP over HTTP –Other bindings can be used (HTTP POST/GET, for examples). –Other carrier extensions are possible.

23 23 Parts of a WSDL Document The total WSDL interface is composed of several decoupled but linked parts: –Messages define the requests and responses. –Port Types are templates for particular services and specify input and output operations. – Bindings define how specific port types are implemented (i.e., with SOAP RPC). –Ports are concrete implementations of Port Types. –Services are collections of one or more ports.

24 24 WSDL Definitions The tag starts the document. –All WSDL name attributes (such as the one in definitions) are used for referring to this section of the document. Schema namespace definitions follow the definition. –You need to specify a namespace for your WSDL

25 25 WSDL Definitions and Namespaces <definitions name="BatchScriptService" targetNamespace="http://yourserver/BatchScriptService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://yourserver/BatchScriptService" xmlns:xsd="http://www.w3.org/1999/XMLSchema">

26 26 WSDL Messages Message tags describe the communications between client and server. For the batch script service, we pass the XML description of the job as a string and get back the script as a string. In general, any XML primitive or complex types can be used in messages. –We could improve our service by defining a BatchScript complex type.

27 27 WSDL Message Example

28 28 WSDL Port Types Next, we define how the messages are organized. A port type corresponds to a Java class, so if we compile this WSDL to make client stubs, we will generate a BatchScriptServiceBinding.java class. Input and output tags link the port to the previously defined messages.

29 29 WSDL Port Types <output message="tns:submitResponse" name="submitResponse"/> <input message="tns:submitRequest" name="submitRequest"/>

30 30 WSDL Bindings Next, we define bindings for our port types (note binding’s “type” attribute points back to the portType tag by name). This is where WSDL gets extended for particular transport mechanisms. –Note the and other tags. –These would be replaced by http or mime bindings, for example, if we were using those.

31 31 WSDL Bindings <soap:body use="encoded" namespace="urn:BatchScriptService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <soap:body use="encoded" namespace="urn:BatchScriptService“ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

32 32 WSDL Ports and Services Ports are concrete implementations of Port Types and point back to a particular Binding (by name). They also point to the specific location of a server that implements the service. A service is a collection of one or more ports.

33 33 WSDL Services BS stands for Batch Script <port binding="BatchBinding” name="BatchPort"> <soap:address location= "http://yourserver/soap/servlet/rpcrouter/"/>

34 34 Using WSDL in Java We use IBM’s Web Service Toolkit (WSTK). –Can examine a Java service class and generate the WSDL and Deployment Descriptor automatically. –For a given WSDL file, it can generate a Java client class that implements the WSDL methods as RPC SOAP calls. –So you can “compile” your WSDL into a client side stub. You then write a client to use this remote object. –Entirely like CORBA+IDL, but entirely optional. Basic SOAP clients may be preferable for dynamically discovering and invoking methods through WSDL.

35 35 Setting Up Your UDDI Registry How to add your service to a registry and how to develop clients that can search the registry.

36 36 What can you get from UDDI? Name of “business” and its services Location of SOAP server(s) that provide these services Locations of WSDL files so you know how to use service Refined descriptions: –Business descriptions –Service canonical categories –Service identifiers

37 37 Setting Up Your UDDI We tried SOAP UDDI, IBM UDDI Preview SOAP UDDI is open source, free, but under development –Can’t search by UDDI search types Case sensitive, wild card searches don’t work –UDDI Categories are not supported –Removing entries from UDDI has bugs IBM’s product is commercial, uses WebSphere, DB2. –Early experience indicates it supports more features. We ran both on Windows 2000 PCs.

38 38 Example: IBM UDDI The following are some screen shots of our UDDI test registry. Following shot is the entry page

39 39

40 40 On Next Slide This lists all the business entries in the UDDI (SDSC and Gateway). Also lists the services that Gateway provides (including the batch script generation service). In general, the UDDI contains Business names, Service Names, Service Types You can search UDDI based on any of these categories. Search can be done through web interface by human, or through by any client program using standard UDDI API.

41 41

42 42 On Previous Page “Service Name” is the list of all names corresponding to the WSDL files for specific services. Example: BatchScriptService. The listed service names correspond to the tag from WSDL. This tells you the location of the SOAP –http://host:8080/soap/servlet/rpcrouterhttp://host:8080/soap/servlet/rpcrouter

43 43 On Next Page This is the display that you get if you click on the BatchScriptService link under Gateway’s Service Name listing. The main thing here is that it tells you where the SOAP server is located.

44 44

45 45 On Next Slide This is what you get if you click the bss- interface link from the main page (slide 41 here). The main thing is that this page tells you where to find the WSDL file for the batch script service.

46 46

47 47 Publishing Your Service Note UDDI Registry is a general business registry, so services may be human-to-human. Add your business (name, description, contact person, locations). Add services: names, how to access (may be web, but may be FAX, phone) –For us, location of SOAP server that has deployed the service. Add the service type. You put the WSDL file location here. This can be done either through the web interface or by a program using the UDDI API.

48 48 Example Service Indiana University and San Diego SC want to offer a batch script generation service. –Agree to the WSDL interface for invoking RPC –Publish in UDDI Registry Two business entities: Gateway and SDSC One service (batch script service) Two locations for SOAP servers. Note WSDLs do not have to be identical if clients are dynamic

49 49 Using API to Publish We are using UDDI4J from IBM (implementation of Java bindings). Most important class: UDDIProxy class: represents UDDI server and its functions. Important methods: –Login to remote server –Write and update business info to server UDDIProxy class methods are invoked on server with SOAP.

50 50 Writing UDDI Clients I want to search the UDDI for a batch script generator. I want to be able to search by –Name of “business” (like SDSC) –Name of service (the batch script service) –Specific queuing systems supported (LSF) See FindData.java for examples.


Download ppt "1 Grid Web Services and Gateway PTLIU Laboratory for Community Grids Marlon Pierce, Choonhan Youn, Geoffrey Fox, Computer Science, Informatics, Physics."

Similar presentations


Ads by Google