200 likes | 325 Views
Web Services (Nuts and Bolts). ITEC 625 Web Development Fall 2006 Reference : Building Web Services with Java (Making sense of XML, SOAP, WSDL, and UDDI), “Web Services Basics Part I” (Chapters 1-6),Graham et al., Developers Library, 2004. Service-Oriented Architectures (SOAs). Main roles
E N D
Web Services (Nuts and Bolts) ITEC 625 Web Development Fall 2006 Reference: Building Web Services with Java (Making sense of XML, SOAP, WSDL, and UDDI), “Web Services Basics Part I” (Chapters 1-6),Graham et al., Developers Library, 2004
Service-Oriented Architectures (SOAs) • Main roles • Service provider • Service description • Service requestor • Service registry • Operations • Publish, find, bind
Why the fuss? • SOA augments and grows your applications portfolio to a portfolio of components (services and apps composed of services) • Organizations better able to construct software to integrate business processes and respond rapidly to changes in business environment. • Implicit, seamless software integration • Approach makes it easier to focus on business processes and tasks as services; less need to focus on underlying technical details of a service. • Easy selection of service interface design, most appropriate and existing IT investments for ease of building SOA, and best business processes.
Justifying Web Services • Application integration is faster, cheaper • Many options for integration using many types of devices (PDAs, cell phones, desktops, etc) • Time to market is reduced • Use of standards provides benefits (choice of tools, more vendor options) • Relatively low cost of entry • Interface-based development reduces time to integrate applications
Web Services vs. SOA • Associated but distinct. • SOA • An architectural concept, approach to building systems that focuses on loosely coupled set of component services that can be dynamically composed. • Web Services • One approach to building an SOA, providing a standard for a particular set of XML-based technologies that can be used to build SOA systems.
XML • Document-centric vs Data-centric • Instances (prolog, elements, attributes) • Namespaces • Schemas • Well-formed, iaw rules of XML syntax • Valid, iaw DTD or Schema • Parsers can be validating/non-validating • If Valid, then well-formed
XML Processing • Pull parsing: application asks parser to give it the next piece of info about the doc • Push parsing, event-based parsing: parser sends info to application about XML doc pieces encountered during the parse, sent in order, as they appear. Simple API for XML (SAX v. 2.0) • One-step parsing, DOM parsing. Parser reads whole document, generates a data structure (tree), deeply nested; DOM is language and platform independent. Don’t map well to native data structures, thus JDOM (Java DOM) for simplifying manipulation of doc trees in Java • Hybrid parsing, combinations • Issues: Memory efficiency, computational efficiency, ease of programming • Also JAXP, Java API for XML Processing, version 1.2
XML Resources • DOM Level 1, 2 • http://www.w3.org/TR/REC-DOM-Level-1 or 2 • JAXB • http://java.sun.com/xml/downloads/jaxb.html • JAXP • http://java.sun.com/xml/xml_jaxp.html • JDOM • http://www.jdom.org/docs/apidocs • JSP1.2 • http://java.sun.com/products/jsp • SAX • http://www.saxproject.org/ • XML, XML Namespaces, XML schema • http://www.w3.org/TR/REC-xml • http://www.w3.org/TR/REC-xml-names • http://www.w3.org/TR/xmlschema-0/ or 1 or 2
SOAP Protocol • Version 1.2 • Two parts for spec • Part 1, the Messaging framework, central foundation • Processing model • Extensibility model • Message structure • Part 2, the Adjuncts • Optional • But give enough to developers (core of Part 1 is not enough)
SOAP Resources • XML Protocol Working Group • http://www.w3.org/2000/xp/Group • SOAP 1.2 and Primer • http://www.w3.org/TR/SOAP • http://www.w3.org/TR/2003/REC-soap12-part0-20030624/ • SOAP with attachments • http://www.w3.org/TR/SOAP-attachments • MTOM • http://www.w3.org/TR/soap12-mtom/ • XOP • http://www.w3.org/TR/xop10/
Describing Web Services • WSDL is an IDL (Interface Description Language) • A WSDL description describes: • What a service does, operations (methods), data needed (arguments and returns) • How a service is accessed, data formats and protocols, etc . • Where a service is located, URL, etc.
Major elements of WSDL • portType • message • types • binding • port • service
WSDL Resources • WSDL 1.1 and 2.0 • http://www.w3.org/TR/wsdl • http://www.w3.org/2002/ws/desc/wsdl20 • WS-Policy and PolicyAttachment • http://www-106.ibm.com/developerworks/library/ws-polfram/ • http://www-106.ibm.com/developerworks/library/ws-polatt/
Implementing Web Services with Apache Axis • One of best Java-based Web services engines • One of most extensible, can be tuned to support new versions of SOAP • Can run on top of simple servlet engine or a full-blown J2EE application server • http://ws.apache.org/axis
Axis Resources • Apache Axis • http://ws.apache.org/axis • Log4j • http://logging.apache.org/log4j/docs/ • Jakarta Discovery library and commons • http://jakarta.apache.org/commons/discovery/ • http://jakarta.apache.org/commons/net/ • JUnit • http://junit.org • SOAP builders • http://groups.yahoo.com/group/soapbuilders
Discovering Web Services • Request copy of service description directly from provider • Centralized service registry (UDDI) • Other publication and service discovery mechanisms • At service provider’s point of offering • Using WS-Inspection specification (see resources) • Public repository of WSDL documents • http://www.salcentral.com • http://www.xmethods.com
UDDI Datatypes • businessEntity • businessService • bindingTemplate • tModel • publisherAssertion
Using a UDDI Registry • A UDDI registry is itself an example of a Web Service • Entries in the registry can be published and queried using a SOAP-based interface • SOAP-based interface is used for all publish and query operations • Publishing usually requires registration and authentication token for creating, updating, deleting entries in the registry • For publishing…Each datatype uses Save API and Delete API • For inquiry… Each datatype uses Find API and Get API
WSDL Service Interface Definitions for UDDI Registry • Inquiry API v2.0 • http://uddi.org/wsdl/inquire_v2.wsdl • Publication API v2.0 • http://uddi.org/wsdl/publish_v2.wsdl • API v3.0 portTypes • http://uddi.org/wsdl/uddi_api_v3_portType.wsdl • API v3.0 Bindings • http://uddi.org/wsdl/uddi_api_v3_binding.wsdl
UDDI Resources • UDDI specs • http://www.oasis-open.org/committees/uddi-spec/doc/tcspecs.htm • UDDI best practices • http://www.oasis-open.org/committees/uddi-spec/doc/bps.htm • UDDI technical notes • http://www.oasis-open.org/committees/uddi-spec/doc/tns.htm • WS-Inspection • http://www-106.ibm.com/developerworks/webservices/library/ws-wsilspec.html