Presentation is loading. Please wait.

Presentation is loading. Please wait.

Accessing and Deploying Web Services Purpose: To build distributed Internet and Intranet applications using standards that allow other applications to.

Similar presentations


Presentation on theme: "Accessing and Deploying Web Services Purpose: To build distributed Internet and Intranet applications using standards that allow other applications to."— Presentation transcript:

1 Accessing and Deploying Web Services Purpose: To build distributed Internet and Intranet applications using standards that allow other applications to share your data and other resources.

2 Access and Deploying Web Services Presentation Synergy 2000 Copyright Sept. 2000, Data Access Worldwide Warning: The information described in the following document describes development of a research project that may change before it becomes a product.

3 Web Protocols – Transport FTP HTTP SMTP

4 Web Protocols - Data XML

5 Important Distributed Programming Protocols COM – Component Object Model CORBA – Common Object Request Broker Architecture Java Remote Method Invocation RMI XML RPC – Barebones spec for XML HTTP transfer SOAP – Simple Object Access Protocol

6 SOAP Simple Object Access Protocol 5/8/2000 SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment. Passes the arguments and metadata in XML. Vendor Support: MS, IBM, Sun, Apache http://www.w3.org/TR/SOAP/ Supports all web transmission protocols Simple Object Access Protocol (SOAP) 1.1 in development

7 SOAP Packet Architecture It is an XML based protocol that consists of three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined data types, and a convention for representing remote procedure calls and responses.

8 What SOAP Packets Describe The SOAP envelope construct defines an overall framework for expressing what is in a message; who should deal with it, and whether it is optional or mandatory. The SOAP encoding rules defines a serialization mechanism that can be used to exchange instances of application-defined data types. The SOAP RPC representation defines a convention that can be used to represent remote procedure calls and responses.

9 Example of Request Packet POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI" DIS

10 Example of Response Packet HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn 34.5

11 Client Server Architecture Diagram that shows SOAP client server invocation. When SOAP uses HTTP wire transfer protocol, it can leap across firewalls, because the port it uses is the same port your web server expects to receive browser requests.

12 SOAP Client – Class Hierarchy cSoapPackager. cWireTransfer cServiceDescriptor cSDMethodInfo cSDEndPointInfo cSDParameterInfo

13 cSoapPackager Function SOAP_LoadServicesDescription Loads a service descriptor language file into an object. Function SOAP_IsMethodAvailable Allows you to determine whether a method is available at a remote site. Function SOAP_MethodStruct – Allows you to query for metadata of a method.

14 More cSoapPackager Set SOAP_PayloadData – Prepares the method element of a SOAP for call/return. Set SOAP_Payload – Prepares Soap Envelope for call/retrun. Function SOAP_Payload – returns the current contents of the SOAP_Payload

15 Even More cSoapPackager Set SOAP_Parameter - Sets the parameter or a return value of a method to a value. Function SOAP_Parameter – Gets the value of a parameter or (in a response object) the return value of a method invocation.

16 cWireTransfer SOAP_PostDataToURI - Sends a request packet to a URI Procedure SOAP_AddStdSoapHeaders – Sets common values (the URI, the method name, and the length of the request/response packet)

17 Simple Method Invocation Get SOAP_LoadServicesDescription Get SOAP_MethodStruct Set SOAP_PayloadData for icRequest Set Parameter Values (by name) using Set SOAP_Parameter Get SOAP_Payload of Request Send SOAP_AddStdSoapHeaders Invoke Get Soap_PostDataToUri Set SOAP_Payload of Response Get SOAP_Parameter

18 SOAP Client – External Calls SOAP_FUNCTION ArticlePrice “GetArticlePrice" ; "http://192.168.1.2/soapsample/services.xm l"; icURI; "http://192.168.1.2/soapsample/services.as p"; String "articleId" RETURNS string "price“ Move (ArticlePrice(sArticleId)) to sPrice

19 ASP File <% OPTION EXPLICIT Response.Expires = 0 CONST SOAP_SDLURI = "http://192.168.1.2/soapsample/services.xml" 'URI of SDL file %> <% Function GetArticlePrice(articleId) GetArticlePrice=oarticles.Call("get_ArticlePrice",articleId) End Function %>

20 Web App Server -NT Object oArticles is a cWebBusinessProcess Function ArticlePrice Integer articleId Returns Number Clear Articles Move articleId to Articles.Article_Id Find Eq Articles By Index.1 Function_Return Articles.Price End_Function Send RegisterInterface get_ArticlePrice "get_ArticlePrice" "articleId" "Returns price" End_Object // oArticles

21 The Glue - SDL File Describes methods that can be invoked for a given service. Describes request and response packets. Describes parameter order Defines schemas and namespaces

22 The WebApp Server for Linux Linux 2.x (e.g. Redhat) Any web server (e.g. Apache) JDK (e.g. Blackdown) Java Servlet Engine (e.g. Tomcat) Web App Server

23 Web App Server Environments Win32Linux RobustnessGoodVery good Management of System Resources FairVery good Platform Web Server Independence NoYes ComponentizedLoad Balancing NoYes Proprietary ImplementationYesNo

24 Contrasting ASP & JSP ASPJSP Reusable ComponentsYes Runs on Unix/LinuxNoYes Runs on WindowsYes Independent Web Server Platform NoYes Open DevelopmentNoYes Customizable TagsNoYes

25 Java Servlet & Java Server Pages Servlets are java programs that are invoked by a web server. They have a simple interface, because they have no UI. The server initializes itself with the init method. The main behavior of the servlet is to respond to a connection at the server, which invokes the service method. The service method takes 2 parameters, ServletRequest and ServletResponse. The servlet is not protocol-specific. The Java Server Page engine is a special servlet that processes (and compiles if necessary) JSPs.

26 A Simple Servlet public class SimpleServlet extends HTTPServlet { public void init() {} public void service(HttpServletRequest req, HttpServletResponse res) { try { ServletOutputStream out = resp.getOutputStream(); resp.setContentType(“text/html”); resp.setStatus(HttpServletResponse, SC_OK); out.println(“ Simple Servlet ”); etc }

27 Apache SOAP Implementation You register a SOAP service using a tool provided by Apache. The name of the java object, the methods you may invoke, and its class (along with other features) are entered. When a POST-ed envelope is receive the arguments are unpacked and a call object is created. The method is then invoked. The return value is then packed into a HTTP response and sent to the caller.

28 Java link to Web App public class Articles extends WebAppSoapBridge { public Articles() { super("SoapSample","oArticles"); } public String getQuantityOnHand(String sArticleID) { if (!setupConnection()) return null; String retVal=call("get_QuantityOnHand", sArticleID); releaseConnection(); return retVal; }

29 Web App Service Object oArticles is a cWebBusinessProcess Function QuantityOnHand String articleId Returns String Clear Articles Move articleId to Articles.Article_Id Find Eq Articles By Index.1 Function_Return Articles.QTY End_Function // RunCustomerReport Send RegisterInterface get_QuantityOnHand "get_QuantityOnHand" "" "Returns QOH" End_Object

30 Demonstration 1. Show VB app and VDF app clients. 2. Show Web App services on NT 3. Show Web App services on Linux. 4. Bring it all together. 5. Use char mode Unix program to change price on Linux box. 6. Show that the change is reflected.

31 Bibliography http://java.sun.com/products/servlet/ - Defines the Java Servlet Specification http://java.sun.com/products/servlet/ http://java.sun.com/products/jsp/ - Defines the Java Server Pages Specification http://java.sun.com/products/jsp/ http://jakarta.apache.org/faq/faqindex.html - Great links to FAQs for related technologies http://jakarta.apache.org/faq/faqindex.html http://xml.apache.org/soap/ www.developer.com www.msdn.microsoft.com www.alphaworks.ibm.com

32 Product Implications Chip will discuss our SOAP initiative and what the consequences and ramifications are for our customers.

33 Q & A This is your chance to ask us any technical questions about what you have seen.


Download ppt "Accessing and Deploying Web Services Purpose: To build distributed Internet and Intranet applications using standards that allow other applications to."

Similar presentations


Ads by Google