73
2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure calls • Service-Oriented Architecture • Web services • Implementation

2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.1

Grid Computing Software Infrastructure

Background information

ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007

• History, remote procedure calls• Service-Oriented Architecture• Web services• Implementation

Page 2: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.21995 2000 200519901985

Distributed computing

Remote Procedure calls (RPC)Concept of service registry

Beginnings of service oriented architecture

Object oriented approachesCORBA (Common Request Broker Architecture)

Java Remote Method Invocation (RMI)

Software Techniques:

Web services

Adopted for grid infrastructure components

Mark-up languages, HTMLXMLClient-server model

Sockets

Internet WWWNetworks

Page 3: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.3

Distributed Computing ConceptsOne of the underlying concepts is the client-server model.

Client

Server

Request service

Server response

ExampleDatabase

Network

Page 4: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.4

Remote Procedure Call

Early “client-server” system introduced in 1980’s.

Allows a local program to execute a procedure on a remote computer and get back results from the procedure.

Basis of certain remote operations such as mounting remote files in a shared file system.

Page 5: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.5

Remote Procedure Call Fundamental issues

We need to know how and where to make the call.

Basic RPC requires calling program to know details about how to make the call (meaning and types augments and return value)

Calling program also needs to know where to send request.

Page 6: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.6

Service Registry

RPC introduced concept of a service registry, a third party used to identify location of “service” (procedure).

Using a service registry is now part of what is now called a Service-Oriented Architecture.

Page 7: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.7

2. Find

3. Bind

1. Publish

Service-Oriented Architecture

Service requester

Service registry

Service provider

Page 8: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.8

Service-Oriented ArchitectureSteps:

• Services “published” in a Service registry.

• Service requestor asks Service Registry to locate service.

• Service requestor “binds” with service provider to invoke service.

Page 9: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.9

Later “RPC” systems(1990’s)

Later forms of remote procedure calls in 1990’s introduced distributed objects:

Examples

• CORBA (Common Request Broker Architecture)

• Java RMI (Remote Method Invocation)

Page 10: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.10

Some aspects for a better system

Need:• Universally agreed standardized

interfaces• Inter-operability• Flexibility• Internet standards (using Internet as

network communication).

Enter Web services and XML

Page 11: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.11

Web Services

• Introduced in the 2000.

• Software components designed to provide specific operations (“services”) accessible using standard Internet technologies and standardized protocols. The specific standards and protocols will be described shortly.

• For machine interaction over a network.

Page 12: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.12

Key aspects

Has similarities with RMI and other distributed object technologies (CORBA etc.) but:

• Web Services are platform independent– They use XML – They use standardized packaging and

Internet network protocols.

Page 13: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.13

Service Description

• Need a way of formally describing a service, what is does, how it is accessed, etc.

• Concept of an Interface Description Language (IDL) developed previously.

Page 14: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.14

XML-based Web Services

• XML provides a flexible basis for storing and retrieving service information on web services.

• In web services, the IDL is an XML language.

• Called Web Service Definition Language (WSDL)

Page 15: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.15

Web Service Definition Language (WSDL)

A W3C standard XML document that describes three fundamental properties of a service:

• What it is - operations (methods) it provides.• How it is accessed - data format, protocols.• Where it is located - protocol specific

network address.

W3C -- The World Wide Web Consortium (W3C), www.w3c.org

Page 16: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.16

Simple Object Access Protocol (SOAP)

Communication protocol for passing XML documents.

W3C specification describes SOAP as:

“SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment. 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 datatypes, and a convention for representing remote procedure calls and responses.”

SOAP originally abbreviation of Simple Object Access Protocol, but now simply SOAP.

Page 17: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.17

Simple Object Access Protocol (SOAP)

Provides mechanisms for:– Defining communication unit - a SOAP

message– Error handling– Extensions– Data representation– Remote Procedure Calls (RPC’s)– Document-centric approach for business

transactions– Binding to HTTP

Page 18: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.18

Web Service Protocols

• Usually a HTTP transport protocol carries SOAP (Simple Object Access Protocol) messages holding XML documents.

XML documentSOAP message

HTTP envelope

Page 19: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.19

SOAP Envelope<SOAP-ENV:Envelopexmlns=“http://schemas.xmlsoap.org/soap/envelope/”>

<SOAP-ENV:header>.

.

</SOAP-ENV:Header>..

<SOAP-ENV:Body>.

.

.

</SOAP-ENV:Body></SOAP-ENV:Envelope>

namespace

Page 20: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.20

What goes down the Wire

HTTP packet containing:– Stuff about context, transactions, routing,

reliability, security– SOAP message– Attachments

XML/SOAP standardization body, World Wide Web Consortium (W3C) covers SOAP and attachments.

Page 21: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.21

Service registries

Page 22: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.22

Universal Description Discovery, and Integration(UDDI) Registry

Web service registries can be based upon UDDI registries introduced in 2001.

UDDI specification standardized by OASIS (Organization for the Advancement of Structured Information Standards)

See: http://www.oasis-open.org

Page 23: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.23

Notes• UDDI registry is a web service itself.

• UDDI registry itself has to be known to both client(s) and service.

• Usually some form of service registration and locator needed.

• In grid computing, basic locator service is called an index service.

Page 24: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.24

Steps to access a web servicein a Service-Oriented Architecture

Client

(Service requester)

Server

(Service provider)

UDDI Service registry

PublishFind

WSDL Service definition

UDDI Service definition

Location of service

Give me your WSDL

WSDL

Request service operation

Result

Page 25: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.25

QuestionCould the WDSL document be provided by the registry, and if so, is that better?

Answer

Page 26: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.26

Web Services “Stack”• HTTP transport• SOAP message carrying XML documents• WSDL (Web Services Description

Language used to describe message syntax for invoking a service and its response.

• UDDI (Universal Description, Discovery and Integration) used as web service discovery mechanism.

Page 27: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.27

Web Services Stack

HTTP

WSDLService description

UDDIService discovery

SOAP + XMLService invocation

Service message transport

Activity Protocol/Language

Page 28: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.28

Web Service Implementation

WSDL, containers, stubs, SOAP …

Page 29: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.29

Web Service Container

• Web Services generally “hosted” in a web service container

– software environment that provides communication mechanisms to and from the web services and clients.

Page 30: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.30

Several possible software environments designed for web services:

• Apache Axis(Apache eXtensible Interaction System)

• IBM Websphere

• Microsoft .NET

• J2EE (Java 2 Enterprise Edition) server container

• Candidate for hosting web services especially in enterprise (business) applications.

Page 31: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.31

Apache Axis available for free down (Windows or Linux):

http://ws.apache.org/axis

Used for a web service assignment in Fall 2004/Fall 2005 grid course, see home page.

Apache Axis requires an application server.– Can be installed on top of a servlet engine such as

Apache Jakarta Tomcat.– However, could be installed on top of a fully-

fleldged J2EE server.

Page 32: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.32

Web service environment

Web service container

Web services Client

Will use an Application server (servlet engine)

(e.g. Apache Jakara Tomcat)

(e.g. Apache Axis)

Network

SOAP messagescarried with HTTP transport

Page 33: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.33

Client-Service Implementation

• In the implementation, it is convenient to use client and service stubs - java classes for interfacing to the web service SOAP messaging.

Page 34: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.34

Client Stub

• Between client code and the network is a client stub, sometimes called client proxy.

• Client stub responsible for taking request from client and converting request into a SOAP request on network - marshalling.

• Also responsible for receiving SOAP responses

on network and converting to a suitable form for client.

Page 35: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.35

Server Stub

• Between service and network is a server stub, sometimes called a skeleton.

• Responsible for receiving SOAP request from client stub and converting it into a suitable form for the service - unmarshalling.

• Also converts response from service into a SOAP message for client stub.

Page 36: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.36

Web Service Application

Call client stubSOAP

requestRequest service

Result returned SOAP

responseClient receives result

Page 37: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.37

Steps

• Client calls client stub.

• SOAP request sent across network

• Server stub receives request and sends request to service

• Service send result to serve stub

• Server stub sends result across network to client stub.

• Client stub sends result to client.

Page 38: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.38

Math Web service

For concreteness, let us consider web service used in Fall 2004/2005 assignment 1. A simple version is:

public class MyMath{

public int squared(int x){

return x * x;}

}

Page 39: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.39

Question

What does this service do?

Answer

Page 40: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.40

Web Service Description

• Recall use an Interface Description language (IDL) called WSDL to formally describe a service, what is does, how it is accessed, etc.

Page 41: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.41

Parts of a WSDL Document

• Root definitions - namespaces

• portType definitions - abstract definition of service

• Message definitions - parameters in method signature

• Type definitions - data types

• Binding definitions - to protocols i.e. SOAP over HTTP

• Service definitions - where service is, ports

Page 42: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.42

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://DefaultNamespace"xmlns:apachesoap="http://xml.apache.org/xml-soap"xmlns:impl="http://DefaultNamespace"xmlns:intf="http://DefaultNamespace"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:message name="squaredRequest"><wsdl:part name="in0" type="xsd:int"/>

</wsdl:message><wsdl:message name="squaredResponse">

<wsdl:part name="squaredReturn" type="xsd:int"/></wsdl:message><wsdl:portType name="MyMath">

<wsdl:operation name="squared" parameterOrder="in0"><wsdl:input message="impl:squaredRequest" name="squaredRequest"/><wsdl:output message="impl:squaredResponse" name="squaredResponse"/>

</wsdl:operation></wsdl:portType><wsdl:binding name="MyMathSoapBinding" type="impl:MyMath">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/ soap/http"/><wsdl:operation name="squared">

<wsdlsoap:operation soapAction=""/><wsdl:input name="squaredRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:input><wsdl:output name="squaredResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:output></wsdl:operation>

</wsdl:binding><wsdl:service name="MyMathService">

<wsdl:port binding="impl:MyMathSoapBinding" name="MyMath"><wsdlsoap:address location="http://localhost:8080/axis/testaccount/ MyMath"/>

</wsdl:port></wsdl:service>

</wsdl:definitions>

Namespaces

Message definitions

portType

Bindings

Service definitions

WSDL file for math web service

Page 43: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.43

Root Definitions Namespaces

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions targetNamespace="http://DefaultNamespace"

xmlns:apachesoap="http://xml.apache.org/xml-soap"

xmlns:impl="http://DefaultNamespace"

xmlns:intf="http://DefaultNamespace"

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Page 44: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.44

portTypeDescribes “What” - an abstract definition of service operation.

Uses the elements:

• message definitions - a set of parameters referred to by method signature, decomposed into parts

• type definitions - defines all data types used

Page 45: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.45

<wsdl:portType name="MyMath">

<wsdl:operation name="squared" parameterOrder="in0">

<wsdl:input message="impl:squaredRequest“

name="squaredRequest"/>

<wsdl:output message="impl:squaredResponse“

name="squaredResponse"/>

</wsdl:operation>

</wsdl:portType>

portType Definitions

Page 46: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.46

<wsdl:message name="squaredRequest">

<wsdl:part name="in0" type="xsd:int"/>

</wsdl:message>

<wsdl:message name="squaredResponse">

<wsdl:part name="squaredReturn" type="xsd:int"/>

</wsdl:message>

Message Definitions

Standard XML integer type –no special types in this example

Page 47: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.47

Binding

Describes “how” the elements in abstract interface (portType) are converted in actual data representations and protocols e.g. SOAP over HTTP.

Page 48: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.48

<wsdl:binding name="MyMathSoapBinding" type="impl:MyMath">

<wsdlsoap:binding style="rpc"

transport="http://schemas.xmlsoap.org/ soap/http"/>

<wsdl:operation name="squared">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="squaredRequest">

<wsdlsoap:body

encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"

namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:input>

<wsdl:output name="squaredResponse">

<wsdlsoap:body

encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"

namespace="http://DefaultNamespace" use="encoded"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

Binding definitions

Page 49: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.49

port and service

Describe “where” service is.

• port - describes how a binding is deployed at the endpoint of a network

• service - a named collection of ports

Page 50: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.50

<wsdl:service name="MyMathService">

<wsdl:port binding="impl:MyMathSoapBinding“

name="MyMath">

<wsdlsoap:address

location="http://localhost:8080/axis/myaccount/MyMath"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Port/Service Definitions

Where math service is

Page 51: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.51

Build and deploy a web service

Several ways to create web service within a container and have accessible by clients.

Fundamental service components to build:

• Web service code

• WDSL service description file

• Web service stub

and client components:

• Client stub

• Client code

Page 52: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.52

What to create to deploy and test a service

Client Client stub

Server stub

Service

ContainerClient Applications

WSDLservice

description

Web service code

WDSL service description file

Web service stubClient stub

Client code

Page 53: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.53

In the following, will assume that we are using Apache Axis, which has several tools for building and deploying a web service.

Page 54: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.54

Java Web Service (JWS) deployment facility

Absolute simplest way in Axis to deplore a web service: • First, web service class file with methods created.• Then file simply renamed as .jws and dropped into a specific

directory that axis expects .jws services to be.

Service code with .jws extension interpreted as a web service. .jws file automatically compiled if necessary when service called. All public methods in service code available and accessible as service operations.

• Simple but has restrictions/limitations.

Page 55: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.55

jws facility

Could actually use web service after deployment with JWS without using a WSDL file nor stubs.

One could just use service URL, which would have a .jws extension. Client and service need code to make SOAP calls.

However, one would normally create a WSDL file and stubs, and get stubs to handle SOAP.

Page 56: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.56

Creating WSDL file

Several ways this can be approached:

• Create service code first and use as basis for WSDL file

or• Create WSDL file first and use this as basis

for the service code

Second method probably better from a Software Engineering perspective, but will look at both.

Page 57: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.57

WSDL from Service CodeJava2WSDL Tool

Axis Java2WSDL program generates WSDL file (and its schema) from service code.

Program has number of flags including to specify:

• Name of the output WSDL file (-o flag)

• Location (URL) of the service (-l flag)

• Namespace of WSDL file (-n flag)

• Mapping from package to namespace (-p flag)

Page 58: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.58

<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions targetNamespace="http://DefaultNamespace"xmlns:apachesoap="http://xml.apache.org/xml-soap"xmlns:impl="http://DefaultNamespace"xmlns:intf="http://DefaultNamespace"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"><!--WSDL created by Apache Axis version: 1.2Built on May 03, 2005 (02:20:24 EDT)-->

<wsdl:message name="squaredRequest"><wsdl:part name="in0" type="xsd:int"/>

</wsdl:message><wsdl:message name="squaredResponse">

<wsdl:part name="squaredReturn" type="xsd:int"/></wsdl:message><wsdl:portType name="MyMath">

<wsdl:operation name="squared" parameterOrder="in0"><wsdl:input message="impl:squaredRequest" name="squaredRequest"/><wsdl:output message="impl:squaredResponse" name="squaredResponse"/>

</wsdl:operation></wsdl:portType><wsdl:binding name="MyMathSoapBinding" type="impl:MyMath">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/ soap/http"/><wsdl:operation name="squared">

<wsdlsoap:operation soapAction=""/><wsdl:input name="squaredRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"

namespace="http://DefaultNamespace" use="encoded"/></wsdl:input><wsdl:output name="squaredResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"

namespace="http://DefaultNamespace" use="encoded"/></wsdl:output>

</wsdl:operation></wsdl:binding><wsdl:service name="MyMathService">

<wsdl:port binding="impl:MyMathSoapBinding" name="MyMath"><wsdlsoap:address location="http://localhost:8080/axis/testaccount/ MyMath"/>

</wsdl:port></wsdl:service>

</wsdl:definitions>

WSDL file created

Page 59: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.59

Stubs from WSDL

• If we have WSDL document for service, can use tools to generate client and server stubs.

– Axis WSDL2Java program generates stubs for use on client and server.

Page 60: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.60

Web Service Deployment Descriptor (WSDD)

• WSDD is an XML language used to describe how to deploy a service.

• Provides for greater flexibility than with jws “instant” deployment facility.

Page 61: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.61

WSDD file for MyService

<deployment xmlns="http://xml.apache.org/axis/wsdd/

xmlns:java=

"http://xml.apache.org/axis/wsdd/providers/java">

<service name="MyService" provider="java:RPC">

<parameter name="className" value="... MyService"/>

<parameter name="allowedMethods" value="*"/>

</service>

</deployment>

Page 62: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.62

Deployment with WSDD file

Once WSDD file say called service.wsdd created, can deploy service with Axis tool, AdminClient:

java org.apache.axis.client.AdminClient service.wsdd

(WSDD was not used in assignment 1 in Fall 2004/5)

Page 63: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.63

Client side programmingOnce deployed service, want to use it or allow others to use it. Depending upon details of deployed service and web service environment, a simple Java program can be used to access service such as:

import localhost.axis.yourusername.MyMath_jws.MyMathServiceLocator;import localhost.axis.yourusername.MyMath_jws.MyMathService;import localhost.axis.yourusername.MyMath_jws.MyMath;

public class MyMathClient {public static void main(String args[]) throws

Exception { MyMathService service = new MyMathServiceLocator(); MyMath myMath = service.getMyMath(); int x = (new Integer(args[0])).intValue(); System.out.println("The square of " + args[0] + " is "

+ myMath.squared(x)); }}

Page 64: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.64

More informationAssignment 1 in Fall 2004/Fall 2005 grid computing required one to write and deploy a web service into tomcat container using axis tools, and test it with a simple client, see:

http://www.cs.uncc.edu/~abw/ITCS4010F05/assign1.doc

This assignment dropped from Spring 2007 to allow us to other new true grid computing assignments.

Page 65: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.65

Quiz(Multiple Choice)

Page 66: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.66

What is a WSDL document?

(a) One that describes how to access a service

and use it

(b) One that describes the data of a service

(c) One that describes how to use the client code

(d) None of the other answers

Page 67: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.67

What is SOAP?

(a) Something you use to clean yourself

(b) A protocol for passing XML

documents

(c) A protocol for passing object-oriented

programs

(d) None of the other answers

Page 68: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.68

What can UDDI be used for?

(a) To transmit data between computers

(b) As a universal data description interface

(c) As a web services registry

(d) To encode the characters of the world

Page 69: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.69

What is Apache Axis?

(a) A tool used by American Indians

(b) A hosting environment for web services

(c) A compiler

(d) A type of make tool

Page 70: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.70

Which of the following contains all the services that have been deployed?

(a) Class

(b) Shell

(c) Container

(d) Object

Page 71: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.71

What is a client stub?

(a) A way of offending a customer

(b) Code between the client code and the

network

(c) A document that explains the client code

(d) None of the other answers

Page 72: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.72

More information on Axis

http://xml.apache.org/axis

Page 73: 2b.1 Grid Computing Software Infrastructure Background information ITCS 4146/5146, UNC-Charlotte, B. Wilkinson, 2007 Feb 2, 2007 History, remote procedure

2b.73

Questions