Web Services and Application Development Frameworks Supplemental Lecture **NOT ASSESSIBLE**

  • Published on
    06-Jan-2016

  • View
    31

  • Download
    0

DESCRIPTION

Web Services and Application Development Frameworks Supplemental Lecture **NOT ASSESSIBLE**. Web Services. Web Services are used primarily as a means for businesses to communicate with each other and with clients. - PowerPoint PPT Presentation

Transcript

  • Web Services and Application Development Frameworks

    Supplemental Lecture**NOT ASSESSIBLE**

    ICT337 Week13 Supplemental: Web Services

  • Web Services

    Web Services are used primarily as a means for businesses to communicate with each other and with clients. They allow organisations to transfer data without knowing the details of the IT systems behind the firewall. Web services do not provide the user with a GUI, rather they share business logic, data and processes through a programmatic interface across a network.

    ICT337 Week13 Supplemental: Web Services

  • Web Services

    Web services allow different applications from different sources to communicate with each other without custom coding, and because all communication is in XML, Web services are not tied to any one operating system or programming language.For example, Java can talk to Perl, Windows applications can talk with UNIX applications.

    ICT337 Week13 Supplemental: Web Services

  • Web Services

    Web Services is our current generation of technologies to allow application-to-application (program-to-program) communication by using XML.It covers how to:define modular, self-describing applicationspublish the applications so they are availablelocate these available applications from anywhereinvoke these applications remotelyAll these using open Internet standards like XML, HTTP and SMTP.

    ICT337 Week13 Supplemental: Web Services

  • Web Services

    Please note the difference between this technical use of the word Web Services and the non-technical use of web services, which refers to any program available through an HTML form over the web.

    ICT337 Week13 Supplemental: Web Services

  • Distributed Object Technologies

    There have been past efforts to provide program-level object exchange:OMGs CORBA/IIOP (www.corba.org/)Microsofts DCOM (www.microsoft.com/com/tech/dcom.asp)Java RMI (java.sun.com/rmi)

    But all of these technologies suffer from:Complex set-up and object invocation.Platform and language dependence.Lack of universal acceptance.Lack of extensibility to different problem areas.

    ICT337 Week13 Supplemental: Web Services

  • What is missing today?What is missing today is a consistent way to allow a service (program, application) communication with another:

    There is no consistent framework for describing how a service can be invoked. eg. how do I use a particular PHP application? There is no consistent framework for listing available services, and how clients can discover them. eg. how do I find out what other PHP applications are available?Location of services on the web and how to use them have to be manually determined, and then manually invoked - they cant be done by programs automatically.

    ICT337 Week13 Supplemental: Web Services

  • Developing Web ServicesVarious companies and organisations have taken strong initiatives to gain and maintain the loyalty of software developers as we move towards Web Services.

    The two biggest initiatives:SUN and the Java approachMicrosofts .NET

    ICT337 Week13 Supplemental: Web Services

  • Microsoft .NET

    .NET is a model targeted at migrating Microsofts focus from desktop-based software towards Internet-based software.

    Uses XML as the basis for data exchange.

    ICT337 Week13 Supplemental: Web Services

  • Components of .NET

    Different parts of the .NET initiative:Tools for software developers Visual Studio .NETthe .NET Framework (consisting of a runtime engine CLR, languages ASP.NET and C#, XML classes, etc)

    .NET Enterprise Serverswhere all the data will reside and be served frome.g.. BizTalk 2000, Commerce Server 2000, SQL Server 2000, etc.

    .NET operating systems.

    Building Block Services.Collections of complete services for integrating into other software. e.g.. Passport .NET for user authentication

    ICT337 Week13 Supplemental: Web Services

  • Suns ONE

    Sun Microsystems's future vision of web services is based on its Open Net Environment (ONE) initiative.

    Heavy promotion of developments in Java technologiesEspecially in its J2EE (Java 2 Enterprise Edition)

    ICT337 Week13 Supplemental: Web Services

  • Platform Independence

    These are the two biggest initiatives in the industry today to lock Internet service and application developers into one environment.

    Microsoft claims programming language independence with .NET (ONE uses Java), while Sun claims operating system independence with ONE (.NET requires Microsoft OS and servers to operate).

    ICT337 Week13 Supplemental: Web Services

  • Advantages claimed by .NETCross-language development.Power and Integration of Visual Studio.Net as a development tool.Simpler programming model - easier to pick up.Interweaved with the operating system - makes use of the powerful facilities available.

    ICT337 Week13 Supplemental: Web Services

  • Advantages claimed by JavaProven technology in the enterprise environment.Systems portable to other operating systems.More advanced and powerful programming model.Standards developed by an industry instead of one vendor.

    ICT337 Week13 Supplemental: Web Services

  • Other FrameworksOther organisations also push their own versions of development frameworks, although not as extensive or as fanatically, as Java or .NET.

    eg.IBMs WebSpherehttp://www-3.ibm.com/software/info1/websphere/index.jsp?tab=highlightsBEAs WebLogichttp://www.bea.com/products/weblogic/platform/index.shtmlApache XML Projecthttp://xml.apache.org/

    ICT337 Week13 Supplemental: Web Services

  • Source: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconwebservicesinfrastructure.aspWeb Service Example

    ICT337 Week13 Supplemental: Web Services

  • Components of Web ServicesIn Web Services, we

    describe a service using the Web Services Description Language (WSDL).

    define a way to publish and discover information about Web services using Universal Description, Discovery and Integration (UDDI), and

    invoke the service using Simple Object Access Protocol (SOAP).

    We will look at WSDL and SOAP.

    ICT337 Week13 Supplemental: Web Services

  • WSDLA WSDL document describesWhat the service can doWhere it residesHow to invoke itWSDL are like IDL but lot more flexible and extensibleDefines binding for SOAP1.1, HTTP GET/POST and MIMEWSDL descriptions can be made available from an UDDI registryWSDL1.1 DocumentStructureWSDLDocument[Types]{Messages}{Port Types}{Bindings}{Services}

    ICT337 Week13 Supplemental: Web Services

  • WSDLWSDL can be generated dynamically by web service frameworks, or from scratch.Creating a WSDL from scratch allows for a great deal of flexibility and makes it easier for consumers of web services to create clients when not using proxy-generated classes.WSDL has the ability to specify a specific ordering of element, cardinality and optionality, etc.

    ICT337 Week13 Supplemental: Web Services

  • SOAPXML based protocol for exchange of informationEncoding rules for datatype instancesConvention for representing RPC invocationsDesigned for loosely-coupled distributed computingNo remote referencesUsed with XML SchemaTransport independentSOAP with Attachments allow arbitrary data to be packaged.SOAP1.1 MessageStructureSOAPEnvelopeHeaderEntries[Header Element]Body Element[FaultElement]

    ICT337 Week13 Supplemental: Web Services

  • Methods of Implementing in JavaMany text books on Web Services tend to present far too much theory and few examples that can help you to create your own Web Services.No service, regardless of its percieved benefits can be considered useful unless there are applications, tools, and reference materials that make development easierLook for very recent text books. Most of the older ones are heavy on theory and use packages that are out of date. Many of the examples wont work unless you can track down an older version of the tool.

    ICT337 Week13 Supplemental: Web Services

  • Methods of Implementing in JavaThere are Applications/Tools that can make creating and running your own web services in Java very easy. The most notable include.Java Web Services Developer PackAXISElectric Glue

    ICT337 Week13 Supplemental: Web Services

  • AXISAxis is essentially a SOAP engine -- a framework for constructing SOAP processors such as clients, servers, gateways, etc.The current version of Axis is written in Java.Supports 3 modes of services-RPC default Object based. AXIS hides all the complicated implementation from you.Document/Wrapped uses plain XML.Message based XML contained in java XML objects.a simple stand-alone server.a server which plugs into servlet engines such as Tomcat, extensive support for the Web Service Description Language (WSDL), emitter tooling that generates Java classes from WSDL. some sample programs, and a tool for monitoring TCP/IP packets.A tool for monitoring raw SOAP messages.

    ICT337 Week13 Supplemental: Web Services

  • AXIS - InstallationMake sure that you haveJ2SE SDK 1.3 or 1.4: We will use 1.4A Servlet Container: We will use Tomcat Download the AXIS package from http://xml.apache.org/axisUnzip it and look at the dir. tree. Note that Axis runs as a Servlet.Deploy Axis.Copy webapps\axis tree to webapps directory of Tomcat.Alternatively, modify server.xml of Tomcat.Run Tomcat.Test the installation with the test JSP. Load http://localhost/axis/happy.jsp. This script will tell you if anything else is required.Direcotry Structure:axisdocslibwebappssamplesaxisWEB-INFlibclassesweb.xml

    ICT337 Week13 Supplemental: Web Services

  • AXIS - SetupThe above will generally install AXIS for use by Tomcat.If you compile/run anything from the command line, you will need to make the AXIS jars (axis/lib directory) visible so the java compiler and interpreter can find them.You can do this by: - creating a simple batch file that adds each of these jars to the classpath. Then run this each time you run from the command line.Adding each AXIS jar to the CLASSPATH environment variable in windows. If you do it this way java can find the jars without having to do anything supplemental.Create a new environment variable in windows and then include the environment variable when you compile of run java files.If you are using JBuilder or similar, specify the jars as required libraries.

    ICT337 Week13 Supplemental: Web Services

  • Creating web services in AXISTwo mechanisms.

    Java Web Service (JWS) easiest.

    Custom deployment.

    ICT337 Week13 Supplemental: Web Services

  • Creating web services in AXIS - JWSJWSSimple way to create basic web servicesStep 1: Create a java class with the services you want to deploy.Step 2: Save the file with a .jws extension.Step 3: move to webapps/axis directory on Tomcat. Thats it.

    public class echo { public String echoBack(String word) { return "You said "+word; }}

    ICT337 Week13 Supplemental: Web Services

  • Creating web services in AXIS - JWSAXIS takes care of everything for you.If you want to view the wsdl just append ?wsdl to the end of the url.As axis creates a wsdl, the web service can be invoked by any client on any platform using any language (as long as it has any SOAP API).

    ICT337 Week13 Supplemental: Web Services

  • AXIS JWS Clients Manual ClientYou can create a client in one of two ways in AXIS.Create a client from scratch.Dynamically create stubs and skeletons using wdsl2java.Code can be embedded into other applications, servlets, JSPs, etc.Clients that use AXIS are generally object based. However AXIS does support pure XML exchange.

    ICT337 Week13 Supplemental: Web Services

  • AXIS JWS Clients Option 1import org.apache.axis.client.Call;import org.apache.axis.client.Service;

    public class echoClient{ public static void main(String [] args) throws Exception { String endpoint = "http://localhost/axis/echo.jws"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName("echoBack"); String ret = (String) call.invoke( new Object [] { "Your mother" }); System.out.println("Got result : " + ret); } }

    ICT337 Week13 Supplemental: Web Services

  • AXIS JWS Clients Option 1

    ICT337 Week13 Supplemental: Web Services

  • AXIS JWS Clients Option 2In the second option we use wsdl2java to generate some skeletons and stubs and the write a small client.Issue the command: - java org.apache.axis.wsdl.WSDL2Java http://localhost/axis/echo.jws?wsdl This will create a package with some java skeletons in it. In our case it created-localhost\axis\echo_jws\Echo.javalocalhost\axis\echo_jws\EchoService.javalocalhost\axis\echo_jws\EchoServiceLocator.javalocalhost\axis\echo_jws\EchoSoapBindingStub.javaEchoSoapBindingStub is the one we are concerned with. It provides an object with a number of constructors and an echoBack method that we can use like a normal java object.

    ICT337 Week13 Supplemental: Web Services

  • AXIS JWS Clients Option 2import localhost.axis.echo_jws.*;import java.net.URL;import org.apache.axis.client.Service;

    public class echoClient2{ public static void main(String [] args) throws Exception { EchoSoapBindingStub ser=new EchoSoapBindingStub(new URL("http://localhost/axis/echo.jws"),new Service()); String ret = ser.echoBack("my mother"); System.out.println("Got result : " + ret); } }

    ICT337 Week13 Supplemental: Web Services

  • AXIS JWS Clients Option 2

    ICT337 Week13 Supplemental: Web Services

  • Creating web services in AXIS Custom Deployment using Web Service Deployment Descriptor (WSDD) JWS is easy and fast but with the following limitations-you need to expose the source.the amount of configuration you can do as to how the service gets accessed is pretty limited.you can't specify custom type mappings, or control which Handlers get invoked when people are using your service.Using WSDD we can run configurable services with advanced options.

    ICT337 Week13 Supplemental: Web Services

  • AXIS - WSDDImplementing a web service using WSDD only requires a few additional steps.Compile the java class, rather than just giving it a .jws extension.Create a WSDD file which tells AXIS how to deploy the class.Run the adminClient to send the service to the AXIS server for deployment.

    ICT337 Week13 Supplemental: Web Services

  • AXIS WSDD deploying a serviceTo deploy echo.java as a serviceCompile echo.java.Move echo.class to webapps\axis\WEB-INF\classes.Create a WSDD file

    ICT337 Week13 Supplemental: Web Services

  • AXIS WSDD deploying a serviceUse the adminClient to deploy the service. The p80 at the end is used to specify the port (needed if not running on port 8080).

    ICT337 Week13 Supplemental: Web Services

  • AXIS WSDD deploying a serviceTest the service is up and running by loading in a browser. Note the addition of services in the url.

    ICT337 Week13 Supplemental: Web Services

  • AXIS WSDD deploying a serviceThe clients created earlier will still work after we modify the url.

    ICT337 Week13 Supplemental: Web Services

  • AXIS WSDD undeploying a serviceIf we need to remove a web service then we need to undeploy it. Create an undeploy wsdd file Run the adminClient to undeploy the service

    ICT337 Week13 Supplemental: Web Services

  • AXIS WSDDThe process of deploying/undeploying is relatively simple.Unless we need to configure the service differently, you can co...

Recommended

View more >