Eclipse Web Tools Platform Project © 2005 IBM Corporation Developing Web Services with Eclipse – Programming Examples Arthur Ryman IBM Rational ryman@ca.ibm.com.

Презентация:



Advertisements
Похожие презентации
Arthur Ryman IBM Rational Developing Web Services with Eclipse.
Advertisements

WEB SERVICES Mr. P. VASANTH SENA. W EB SERVICES The world before Situation Problems Solutions Motiv. for Web Services Probs. with Curr. sols. Web Services.
© 2006 IBM Corporation Made available under the EPL v WebSphere Services Technical Conference world class skill building and technical enablement.
© Luxoft Training 2013 Annotations. © Luxoft Training 2013 Java reflection / RTTI // given the name of a class, get a "Class" object that // has all info.
© 2002 IBM Corporation Confidential | Date | Other Information, if necessary Developing Web Services with Eclipse Arthur Ryman Web Service.
© 2006 IBM Corporation Made available under the EPL v WebSphere Services Technical Conference world class skill building and technical enablement.
Eclipse Web Tools Platform Project © 2005 IBM Corporation Developing Web Services with Eclipse Arthur Ryman, IBM EclipseWorld, New York
© 2006 by IBM; made available under the EPL v1.0 | Cambridge | September 8, Developing Java Web Services with WTP Arthur Ryman IBM Rational Software.
© 2006 Cisco Systems, Inc. All rights reserved. HIPS v Using CSA Analysis Generating Application Deployment Reports.
1 Анна Юфкина Специалист по бизнес-решениям
1/27 Chapter 9: Template Functions And Template Classes.
Structured Error Handling in the ABL Sarah Marshall QA Architect, OpenEdge Session 128.
© 2006 Cisco Systems, Inc. All rights reserved. HIPS v Administering Events and Generating Reports Managing Events.
Evgeniy Krivosheev Andrey Stukalenko Vyacheslav Yakovenko Last update: Nov, 2013 Spring Framework Module 1 - Introduction.
Developing a PDMWorks Enterprise add-in in Microsoft VB.NET Jonathan Freeson Senior Consultant / Partner xLM Solutions, LLC.
© 2005 Cisco Systems, Inc. All rights reserved. BGP v Route Selection Using Policy Controls Using Multihomed BGP Networks.
Using Actional with OpenEdge The Zen of Business Transaction Assurance David Cleary Principal Software Engineer – Progress Software Session 116.
© 2006 Cisco Systems, Inc. All rights reserved. BSCI v Configuring EIGRP Using EIGRP in an Enterprise Network.
1/13 Chapter 06- Implementing Operators in a class.
© 2006 Cisco Systems, Inc. All rights reserved.ONT v Describe Cisco VoIP Implementations Implementing Voice Support in an Enterprise Network.
Транксрипт:

Eclipse Web Tools Platform Project © 2005 IBM Corporation Developing Web Services with Eclipse – Programming Examples Arthur Ryman IBM Rational EclipseWorld New York,

Eclipse Web Tools Platform Project © 2005 IBM Corporation 2Developing Web Services with Eclipse, EclipseWorld, New York Development Scenarios Accessing Web Services Creating Web Services –Bottom-Up –Top-Down

Eclipse Web Tools Platform Project © 2005 IBM Corporation 3Developing Web Services with Eclipse, EclipseWorld, New York Accessing Web Services The preceding demo generated a JSP test client for the Stock Quote service Well now code a JSP client application that accesses it The Web Service wizard generated JAX-RPC compliant client code and a convenience wrapper Well use this code in our client

Eclipse Web Tools Platform Project © 2005 IBM Corporation 4Developing Web Services with Eclipse, EclipseWorld, New York JAX-RPC Client Code

Eclipse Web Tools Platform Project © 2005 IBM Corporation 5Developing Web Services with Eclipse, EclipseWorld, New York JAX-RPC Client Code package NET.webserviceX.www –targetNamespace=" StockQuoteLocator.java – Service locator StockQuoteLocator.java StockQuote.java – Service interface StockQuote.java – StockQuoteSoap.java – Remote interface StockQuoteSoap.java – StockQuoteSoapStub.java – Client stub wrapper for Call object StockQuoteSoapStub.java StockQuoteSoapProxy.java – Client proxy convenience wrapper StockQuoteSoapProxy.java

Eclipse Web Tools Platform Project © 2005 IBM Corporation 6Developing Web Services with Eclipse, EclipseWorld, New York Web Client Version 1: getQuote.jspgetQuote.jsp 1)Create a JSP 1)get a query parameter, symbol, 2)create a service proxy, and 3)invoke the getQuote operation 2)Select getQuote.jsp and invoke Run As->Run on ServergetQuote.jsp 1)The Web app is added to the server, 2)the server is started, and 3)a Web browser is opened on the appropriate URL for getQuote.jsp getQuote.jsp

Eclipse Web Tools Platform Project © 2005 IBM Corporation 7Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 8Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 9Developing Web Services with Eclipse, EclipseWorld, New York Processing XML This service has a poorly designed interface –XML is returned as an escaped string –No schema for result The client needs to parse the result to extract the price, etc. Client application can parse XML using: –DOM, –SAX, –Java data binding code (JAXB, etc), or –server-side XSLT For fun, well use browser-side XSLT

Eclipse Web Tools Platform Project © 2005 IBM Corporation 10Developing Web Services with Eclipse, EclipseWorld, New York Web Client Version 2: getQuote-xsl.jspgetQuote-xsl.jsp 1)View example of XML response ibm-quote.xmlibm-quote.xml 2)Create XSLT StockQuotes.xslStockQuotes.xsl 1)Generate to get symbol 2)Generate to present stock quote 3)Create JSP getQuote-xsl.jspgetQuote-xsl.jsp 1)Insert processing instruction 2)Return unparsed XML 4)Run on Server to view result

Eclipse Web Tools Platform Project © 2005 IBM Corporation 11Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 12Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 13Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 14Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 15Developing Web Services with Eclipse, EclipseWorld, New York Bottom-Up Web Service Creation Any reasonable Java class can be easily deployed as a Web service This approach is very appealing to Java programmers since it lets them be immediately productive The WSDL is generated from the Java The result is acceptable if the methods use tame argument types, however object graphs are problematic Top-Down design is recommended to achieve the cleanest and most interoperable Web service interfaces

Eclipse Web Tools Platform Project © 2005 IBM Corporation 16Developing Web Services with Eclipse, EclipseWorld, New York Bottom-Up Service: BUService 1)Create a new Web project: BUService 2)Create a data object to represent the result: BUStock.javaBUStock.java 3)Create a business object to take a symbol and return a stock quote for it: BUQuoter.javaBUQuoter.java 4)Use the Web service wizard to deploy it. Use rpc-encoded style for fun so we can see WS-I errors. Generate and monitor a JSP test client. 5)Test the service, view the messages in the monitor, and validate the SOAP messages for WS-I conformance. Note the errors caused by rpc-encoded style.

Eclipse Web Tools Platform Project © 2005 IBM Corporation 17Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 18Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 19Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 20Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 21Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 22Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 23Developing Web Services with Eclipse, EclipseWorld, New York Top-Down Web Service Creation Business is transacted by exchanging documents – purchase orders, receipts, application forms, insurance claims, building permits, etc. For best interoperability, treat Web services as document interchange, not distributed objects Model documents using XSD, and operations using WSDL Generate Java from WSDL

Eclipse Web Tools Platform Project © 2005 IBM Corporation 24Developing Web Services with Eclipse, EclipseWorld, New York Top-Down Service: TDService 1)Create a new Web project: TDService 2)Create an XML schema for the Stock quote result: TDStock.xsdTDStock.xsd 3)Create a WSDL for the quote service with an operation that takes a symbol and returns a quote: TDQuoter.wsdl. Use the WSDL Binding wizard to generate document-literal SOAP binding style this time.TDQuoter.wsdl 4)Use the Web service wizard to generate the service. 5)Fill in the implementation of the service: TDQuoterSOAPImpl.javaTDQuoterSOAPImpl.java 6)Create a new Web project: TDServiceClient 7)Select /wsdl/TDQuoterSOAP.wsdl, create a JSP test client, and monitor the service. 8)Test the service and validate the SOAP messages for WS-I conformance. There should be no errors this time.

Eclipse Web Tools Platform Project © 2005 IBM Corporation 25Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 26Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 27Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 28Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 29Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 30Developing Web Services with Eclipse, EclipseWorld, New York

Eclipse Web Tools Platform Project © 2005 IBM Corporation 31Developing Web Services with Eclipse, EclipseWorld, New York