370 likes | 575 Views
IT 교수요원 경쟁력 강화를 위한 해외 석학 초빙 IT 기술강좌 SI track : Enterprise Web Service Computing source : Sandeep Chatterjee’s lecture file. Park, Mok-Min 2004.09.20 MAILab. Seminar. News about the Web Services. “ 대형 SI, 웹서비스에 사활 건다 – 기업 · 공공기관 도입 본격화 - 시장 선점경쟁 돌입” [ 디지털 타임즈 2004/03/29]
E N D
IT교수요원 경쟁력 강화를 위한해외 석학 초빙 IT기술강좌SI track : Enterprise Web Service Computingsource : Sandeep Chatterjee’s lecture file Park, Mok-Min 2004.09.20 MAILab. Seminar
News about the Web Services • “대형 SI, 웹서비스에 사활 건다 – 기업 · 공공기관 도입 본격화 - 시장 선점경쟁 돌입” [디지털 타임즈 2004/03/29] • “삼성 SDS, 웹서비스 사업 본격화” • 삼성SDS는 차세대 IT통합 기술을 선도하기 위해 웹서비스를 미래 핵심사업의 하나로 선정, 사업을 본격 추진한다고 22일 밝혔다. [전자신문 2004/6/23] MAILab. Seminar
This is NOT the “Web Services” MAILab. Seminar
Contents • Introduction • Architecture of the system • Feature-based modeling • Agent-based modeling • Intelligent optimal scheduling • Scheduling Quality and Efficiency • Conclusions • Discussion MAILab. Seminar
about the Lecturer • Dr. Sandeep Chatterjee • CEO, Cyndeo • PhD, Computer Science , MIT • Co-author of “Developing Enterprise Web Services: An Architect’s Guide”, Prentice-Hall MAILab. Seminar
Session One:Motivating the Need for Web Services Progression from Web pages to Web applications The need for Web Services
Web Page-based Auto Insurance • Web pages only have static information • The same information is provided for all viewers MAILab. Seminar
Problems with Web Pages • A web page has many problems: • The page must include all type of information, which makes the page very long and cramped • The overflow of information on the page makes it difficult to read and use • Instead of listing ALL of the information on a page • Allow the user enter his particular information • And have the particular result calculated and displayed on the page The motivation for Web Applications MAILab. Seminar
Web Application-based Insurance MAILab. Seminar
Web Application-based Insurance 1. The user enters his car’s information into the browser. 3. The user sees the estimated insurance premium on the browser. 2. The Web application running on the server processes the information about the user’s car and calculates an estimated insurance premium. MAILab. Seminar
The Architecture of Web Applications Industry Standard Interfaces Proprietary Interfaces & Custom Development Web Application Business Logic Web Application User Interface End User The Web MAILab. Seminar
Communications b/w Web Applications Consumer Application • Means of Communications • phone • fax • human Web site interaction Very Best Auto Insurance Auto Insurance Company 1 Auto Insurance Company 2 MAILab. Seminar
Communication Options Auto Insurance Company 1 Very Best Auto Insurance Auto Insurance Company 2 MAILab. Seminar
Session Two:Foundations of Web Services What are Web Services? Web Service Technologies
Definition of Web Services • A software application identified by a URI, whose interfaces and bindings are capable of being defined, described, and discovered as XML artifacts • A Web service supports direct interactions with other software agents using XML-based messages exchanged via Internet-based protocols (W3C) • Web based • Big thrust from major IT vendors • Interoperability supported by international standards From Prof. Park’s lecture note (Expert Systems Application) MAILab. Seminar
The Architecture of Web Services Industry Standard Interfaces Web Application User Interface End User Web Application Business Logic Standard Application The Web Another Web Service MAILab. Seminar
Web Services-based Applications Application Capability A Capability B Capability C Network Monolithic Applications URL Address Capability A Client Application Web Services-based Applications Capability B Capability C MAILab. Seminar
Why Web Services are Important? • ANY application or service can utilize the capabilities of ANY Web service by sending it messages. • Applications can be quickly built and customized by utilizing existing, third-party Web services • Web services are hosted and managed by third-parties • The application developer will not have control over any Web service MAILab. Seminar
SOAP, WSDL, and UDDI • SOAP: Simple Object Access Protocol • Message protocol based on XML • Used to exchange information b/w an application and the Web services it consumes • WSDL: Web Services Description Language • An XML-based language to describe the properties of Web services • Supported operations • Network location • UDDI: Universal Description, Discovery and Integration • A platform-independent registry framework for discovering (search for) Web services MAILab. Seminar
SOAP, WSDL, and UDDI WSDL UDDI Publish Discover Web Service Producer WSDL SOAP Consuming Application SOAP Invoke MAILab. Seminar
SOAP Messaging HellowWorldName SOAP Request Message Operation: getName Argument: String userName SOAP Response Message Return: String “Hello, <username>” MAILab. Seminar
SOAP Request Message SOAP Envelope Required SOAP Header Optional SOAP Body Message (information) Required <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:getName soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://soapinterop.org/"> <userName xsi:type="xsd:string">Park,MokMin</userName> </ns1:getName> </soapenv:Body> </soapenv:Envelope> MAILab. Seminar
SOAP Response Message <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:getNameResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://soapinterop.org/"> <ns1:getNameReturn xsi:type="xsd:string">Hello, Park,MokMin</ns1:getNameReturn> </ns1:getNameResponse> </soapenv:Body> </soapenv:Envelope> MAILab. Seminar
WSDL Web Service Description <?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions targetNamespace="http://localhost:8080/axis/services/HelloWorldNameService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/HelloWorldNameService" xmlns:intf="http://localhost:8080/axis/services/HelloWorldNameService" 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="getNameResponse"> <wsdl:part name="getNameReturn" type="xsd:string" /> </wsdl:message> <wsdl:message name="getNameRequest"> <wsdl:part name="in0" type="xsd:string" /> </wsdl:message> <wsdl:portType name="HelloWorldName"> <wsdl:operation name="getName" parameterOrder="in0"> <wsdl:input message="impl:getNameRequest" name="getNameRequest" /> <wsdl:output message="impl:getNameResponse" name="getNameResponse" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloWorldNameServiceSoapBinding" type="impl:HelloWorldName"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getName"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="getNameRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded" /> </wsdl:input> <wsdl:output name="getNameResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/HelloWorldNameService" use="encoded" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloWorldNameService"> <wsdl:port binding="impl:HelloWorldNameServiceSoapBinding" name="HelloWorldNameService"> <wsdlsoap:address location="http://localhost:8080/axis/services/HelloWorldNameService" /> </wsdl:port> </wsdl:service> </wsdl:definitions> MAILab. Seminar
Laboratory Exercises:Developing Web Services Required Infrastructures Developing Web Services
Required Infrastructures • Java 2 SDK • Apache Tomcat J2EE Application Server • AXIS (Apache eXtensible Integration System) MAILab. Seminar
System Variables setting • Java • Path • C:\j2sdk\bin;C:\j2sdk\jre\bin • Classpath • .;C:\j2sdk\lib\tools.jar; • Tomcat • Classpath • C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar • Axis • Classpath • C:\axis\lib\axis.jar;C:\axis\lib\axis-ant.jar;C:\axis\lib\commons-discovery.jar;C:\axis\lib\commons-logging.jar;C:\axis\lib\jaxrpc.jar;C:\axis\lib\log4j-1.2.8.jar;C:\axis\lib\saaj.jar;C:\axis\lib\wsdl4j.jar; MAILab. Seminar
Web Services on Tomcat Step 1 : Develop the program to make into a Web Service Step 2 : Create a Web Service Deployment Descriptor(WSDD) File Step 3 : Deploy the WS onto Apache Axis/Tomcat Step 4 : Deploy the Java class file Step 5 : Verify the WS Deployment Step 6 : Generate the Local Stub for the Web Service Step 7 : Develop the Application MAILab. Seminar
Step 1. Dev. The Program AutoInsuranceOne.java public class AutoInsuranceOne { public AutoInsuranceOne () { } public intgetQuote ( int zipcode , int numberOfDoors , int value ) { int quote = value / numberOfDoors; return ( quote ); } } MAILab. Seminar
Step 2. Create WSDD file AutoInsuranceOneService.wsdd <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="AutoInsuranceOneService" provider="java:RPC" > <parameter name="className" value="AutoInsuranceOne"/> <parameter name="allowedMethods" value="*"/> </service> </deployment> AutoInsuranceOne.java MAILab. Seminar
Step 3. Deploy the WS >java org.apache.axis.client.AdminClient AutoInsuranceOneService.wsdd MAILab. Seminar
Step 4. Deploy the Java class file • Compile the Java source file • >javac AutoInsuranceOne.java • Place the Java class file in a folder within the System classpath so that it is accessible to Axis • >cp AutoInsuranceOne.class C:Program Files\Apache Group\Tomcat4.1\common\classes MAILab. Seminar
Step 5. Verify the WS Deployment • View all deployed Web services that are deployed on Axis • Start tomcat • Open a web browser and type: http://localhost:8080/axis/servlet/AxisServlet • Review the WSDL file for the deployed Web service MAILab. Seminar
Step 6. Generate the Local Stub > java org.apache.axis.wsdl.WSDL2Java http://147.46.236.73:8080/axis/services/AutoInsuranceOneService?wsdl >cd localhost\axis\services\AutoInsuranceOneService MAILab. Seminar
Step 7. Develop the Application Test_WSApp.java public class Test_WSApp { public Test_WSApp () { } public static void main ( String args[] ) throws Exception { localhost.axis.services.AutoInsuranceOneService.AutoInsuranceOneService aioService; localhost.axis.services.AutoInsuranceOneService.AutoInsuranceOne aioPort; try { aioService = new localhost.axis.services.AutoInsuranceOneService.AutoInsuranceOneServiceLocator (); aioPort = aioService.getAutoInsuranceOneService (); float quote = aioPort.getQuote ( 94404 , 4 , 21000 ); System.out.println ("QUOTE IS: " + quote); } catch ( Exception e ) { System.out.println ( "Error in client proxy." + e ); e.printStackTrace(); } } } MAILab. Seminar
Direct WS Invocation TestDirectInvocation_WSApp.java import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.namespace.QName; public class TestDirectInvocation_WSApp { public TestDirectInvocation_WSApp (){} public static void main ( String args[] ) throws Exception { try{ String endpoint = "http://localhost:8080/axis/services/AutoInsuranceOneService"; Service service = new Service (); Call call = ( Call ) service.createCall (); call.setTargetEndpointAddress ( new java.net.URL ( endpoint ) ); call.setOperationName ( new QName ( "http://soapinterop.org/" , "getQuote" ) ); // Set Argument and return parameters call.addParameter ( "zipcode" , org.apache.axis.Constants.XSD_INT , javax.xml.rpc.ParameterMode.IN ); call.addParameter ( "numberOfDoors" , org.apache.axis.Constants.XSD_INT , javax.xml.rpc.ParameterMode.IN ); call.addParameter ( "value" , org.apache.axis.Constants.XSD_INT , javax.xml.rpc.ParameterMode.IN ); call.setReturnType ( org.apache.axis.Constants.XSD_FLOAT ); Object retObj = call.invoke ( new Object[]{new Integer ( 94404 ), new Integer ( 4 ), new Integer ( 21000 ) }); System.out.println ( "QUOTE IS: " + retObj.toString() ); }catch ( Exception e ){ System.out.println ( "Error in client proxy." + e ); e.printStackTrace (); } } } MAILab. Seminar
Summary • SOAP, WSDL, and UDDI make up the foundations of Web Services • SOAP is for exchanging message • WSDL describes Web services • UDDI helps locate information about Web services • Web services-based application development steps: • Locate the WSDL of the Web service to consume • Generate the local stubs from the WSDL • Develop the application business logic MAILab. Seminar