Presentation is loading. Please wait.

Presentation is loading. Please wait.

6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy.

Similar presentations


Presentation on theme: "6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy."— Presentation transcript:

1 6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy

2 6/11/2015Page 2 Web Services (Colouris) A web service provides a service interface enabling clients to interact with servers in a more general way than web browsers do. Clients access operations in the interface usually by XML messages over http. However other architectural models such as REST and CORBA could access WS. WSDL provides additional details than for standard operation: for encoding, security, communication and location.

3 6/11/2015Page 3 Services, ports and bindings Service endpoint interface (SEI) or service endpoint that defines one or more operations that the web service offers. Access to an endpoint is provided by binding it to a protocol stack through a port. –A port has an address that the client can use to communicate with the service and invoke its operations. An endpoint can be bound to different ports each offering a different suite of protocols for interaction.

4 6/11/2015Page 4 Endpoint, Port and binding SOAP1.1 Over http SOAP 1.1 over https Other. Ex: ebXML over SMTP Port1 port2 port3 endpoint Web services Client Web service https 1.1 transport soap1.1 messages

5 6/11/2015Page 5 Application Architecture Weather Client JAX-WS Stub JAX-WS Runtime (APIs) Transport Weather Service Endpoint impl JAX-WS Ties JAX-WS Runtime (APIs) Transport SOAP/HTTP

6 6/11/2015Page 6 WS Interoperability Infrastructure Network XML Messaging Service Description WSDL SOAP HTTP

7 6/11/2015Page 7 WS Stack Network XML-based Messaging Service Description Service Publication Service Discovery Service Flow HTTP, FTP, MQ Email, IIOP SOAP WSDL UDDI WSFL Security Management Quality of Service

8 6/11/2015Page 8 WSDL Web Services Definition Language for definition of WS in a standard format and for publication to allow discovery by computational agents. Lets understand WSDL –http://www.w3.org/TR/wsdl#_wsdlhttp://www.w3.org/TR/wsdl#_wsdl –http://www.w3schools.com/wsdl/wsdl_documents.asphttp://www.w3schools.com/wsdl/wsdl_documents.asp –http://webservices.amazon.com/AWSECommerceService/AW SECommerceService.wsdl?http://webservices.amazon.com/AWSECommerceService/AW SECommerceService.wsdl –Lets look at the components of WSDL and look at Amazon.com ECS as example

9 6/11/2015Page 9 Anatomy of a WSDL document Service (Name) Porttype Operation name Input message Output message Fault handling Type Definition/ Target name Space/ XML Schema Binding Protocol binding Operation Location/path Input name & type Output name & type Address location (URI)

10 6/11/2015Page 10 Sample WSDL http://www.w3.org/2001/04/wsws- proceedings/uche/wsdl.html http://www.w3.org/2001/04/wsws- proceedings/uche/wsdl.html

11 6/11/2015Page 11 WS Lifecycle Build: –Definition of service interface –Definition of service implementation New services Existing application into WS Composing a WS out of other WS and applications –Source compiled and Stubs and Ties are generated. Deploy: –Publication of the service interface and service implementation to service registry or service requestor. –Deployment of executables in an execution environment.

12 6/11/2015Page 12 WS Lifecycle (contd.) Run: A WS is available for invocation. Requestor can perform find and bind operation. Manage: on going management and administration for security, availability, performance, QoS, and business processes.

13 6/11/2015Page 13 Creation and consumption of WS Based on Sun’s WS discussion.discussion The starting point for developing a JAX-WS web service is a Java class annotated with the javax.jws.WebService annotation. The WebService annotation defines the class as a web service endpoint. A WS method can also be created using annotation.

14 6/11/2015Page 14 Coding WS Hello Server package helloservice.endpoint; import javax.jws.WebService; @WebService() public class Hello { private String message = new String("Hello, "); public void Hello() {} @WebMethod() public String sayHello(String name) { return message + name + "."; } }

15 6/11/2015Page 15 Coding the Hello WS client 1. Uses the javax.xml.ws.WebServiceRef annotation to declare a reference to a web service. WebServiceRef uses the wsdlLocation element to specify the URI of the deployed service's WSDL file. @WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/hello?wsdl") static HelloService service; 2. Retrieves a proxy to the service, also known as a port, by invoking getHelloPort on the service. Hello port = service.getHelloPort(); The port implements the SEI defined by the service. 3. Invokes the port's sayHello method, passing to the service a name. String response = port.sayHello(name);

16 6/11/2015Page 16 Development using an IDE An IDE supports tools for compilation, deployment, automatic generation of proxies, auto completion, auto import of packages, build tool etc.

17 6/11/2015Page 17 Demo: Develop, deploy and consume a sample WS We will use Netbeans IDE (any version above 6.5 should be fine).


Download ppt "6/11/2015Page 1 Web Services-based Distributed System B. Ramamurthy."

Similar presentations


Ads by Google