accessing and deploying web services purpose: to build distributed internet and intranet...

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

Upload: hugo-boone

Post on 13-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

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

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.

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

Access and Deploying Web Services Presentation

Synergy 2000Copyright Sept. 2000, Data Access

WorldwideWarning: The information described in the

following document describes development of a research project that may change before it becomes a product.

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

Web Protocols – Transport

FTPHTTPSMTP

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

Web Protocols - Data

XML

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

Important Distributed Programming Protocols

COM – Component Object ModelCORBA – Common Object Request Broker

Architecture Java Remote Method Invocation RMIXML RPC – Barebones spec for XML HTTP

transferSOAP – Simple Object Access Protocol

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

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

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

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.

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

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.

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

Example of Request Packet POST /StockQuote HTTP/1.1

Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "Some-URI"

<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">   <SOAP-ENV:Body>       <m:GetLastTradePrice xmlns:m="Some-URI">           <symbol>DIS</symbol>       </m:GetLastTradePrice>   </SOAP-ENV:Body></SOAP-ENV:Envelope>

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

Example of Response Packet HTTP/1.1 200 OK

Content-Type: text/xml; charset="utf-8"Content-Length: nnnn

<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>   <SOAP-ENV:Body>       <m:GetLastTradePriceResponse xmlns:m="Some-URI">           <Price>34.5</Price>       </m:GetLastTradePriceResponse>   </SOAP-ENV:Body></SOAP-ENV:Envelope>

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

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.

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

SOAP Client – Class Hierarchy

cSoapPackager.cWireTransfercServiceDescriptorcSDMethodInfocSDEndPointInfocSDParameterInfo

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

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.

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

More cSoapPackager

Set SOAP_PayloadData – Prepares the method element of a SOAP <body> for call/return.

Set SOAP_Payload – Prepares Soap Envelope for call/retrun.

Function SOAP_Payload – returns the current contents of the SOAP_Payload

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

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.

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

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)

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

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

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

SOAP Client – External Calls

SOAP_FUNCTION ArticlePrice “GetArticlePrice" ; "http://192.168.1.2/soapsample/services.xml"; icURI; "http://192.168.1.2/soapsample/services.asp"; String "articleId" RETURNS string "price“

Move (ArticlePrice(sArticleId)) to sPrice

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

ASP File<%@ Language=VBScript %><% OPTION EXPLICIT Response.Expires = 0 CONST SOAP_SDLURI =

"http://192.168.1.2/soapsample/services.xml" 'URI of SDL file%><!--#include file="listener.asp"--><% Function GetArticlePrice(articleId)

GetArticlePrice=oarticles.Call("get_ArticlePrice",articleId) End Function%>

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

Web App Server -NTObject 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

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

The Glue - SDL File

Describes methods that can be invoked for a given service.

Describes request and response packets.Describes parameter orderDefines schemas and namespaces

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

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

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

Web App Server Environments

Win32 Linux

Robustness Good Very good

Management of System Resources

Fair Very good

Platform Web Server Independence

No Yes

ComponentizedLoad Balancing

No Yes

Proprietary Implementation Yes No

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

Contrasting ASP & JSP

ASP JSP

Reusable Components Yes Yes

Runs on Unix/Linux No Yes

Runs on Windows Yes Yes

Independent Web Server Platform

No Yes

Open Development No Yes

Customizable Tags No Yes

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

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.

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

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(“<html><head><title>Simple

Servlet</title></head>”); etc }}

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

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.

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

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; }}

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

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

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

Demonstration

1. Show VB app and VDF app clients.2. Show Web App services on NT3. 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.

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

Bibliography

http://java.sun.com/products/servlet/ - Defines the Java Servlet Specification

http://java.sun.com/products/jsp/ - Defines the Java Server Pages Specification

http://jakarta.apache.org/faq/faqindex.html - Great links to FAQs for related technologies

http://xml.apache.org/soap/ www.developer.com www.msdn.microsoft.com www.alphaworks.ibm.com

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

Product Implications

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

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

Q & A

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