书签 分享 收藏 举报 版权申诉 / 159
上传文档赚钱

类型企业级应用系统体系架构WebService课件.ppt

  • 上传人(卖家):晟晟文业
  • 文档编号:5201079
  • 上传时间:2023-02-16
  • 格式:PPT
  • 页数:159
  • 大小:1.85MB
  • 【下载声明】
    1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
    2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
    3. 本页资料《企业级应用系统体系架构WebService课件.ppt》由用户(晟晟文业)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
    4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
    5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    企业级 应用 系统 体系 架构 WebService 课件
    资源描述:

    1、企业级应用系统体系架构企业级应用系统体系架构(六)(六)Web Service2023-1-6From:OReilly:Enterprise JavaBeans 3.0,5th Edition,May.2006TopicnWeb Services StandardsnWeb Services OverviewnXML Schema and XML NamespacesnSOAP 1.1nWSDL 1.1nUDDI 2.02Web Services OverviewnWeb Services present the opportunity for real interoperability ac

    2、ross hardware,operating systems,programming languages,and applications.nBased on the XML,SOAP,and WSDL standards,web services have enjoyed widespread adoption by nearly all of the major enterprise players,including Microsoft,IBM,BEA,JBoss,Oracle,Hewlett-Packard,and others.Sun Microsystems has integr

    3、ated web services into the Java EE platform;specifically,Sun and the Java Community Process have introduced several web services APIs,including the Java API for XML Web Services(JAX-WS),the Java API for XML-based RPC(JAX-RPC),the SOAP with Attachments API for Java(SAAJ),and the Java API for XML Regi

    4、stries(JAXR).These web services APIs were integrated into J2EE 1.4 and have been expanded upon in Java EE 5 and EJB 3.0.3Web Services OverviewnA web service is a remote application described using the Web Service Description Language(WSDL)and accessed using the Simple Object Access Protocol(SOAP)acc

    5、ording to the rules defined by the WS-I Basic Profile 1.1.nThe WS-I(Web Services Integration Organization)is a group of vendors(Microsoft,IBM,BEA,Sun Microsystems,Oracle,HP,and others)that have banded together to ensure web services are interoperable across all platforms.To do this,they have created

    6、 a recommendation called the Basic Profile 1.1,which defines a set of rules for using XML,SOAP,and WSDL together to create interoperable web services.4Web Services Overview5TopicnWeb Services StandardsnWeb Services OverviewnXML Schema and XML NamespacesnSOAP 1.1nWSDL 1.1nUDDI 2.06XML SchemanAn XML S

    7、chema is similar in purpose to a Document Type Definition(DTD),which validates the structure of an XML document.To illustrate some of the basic concepts of XML Schema,lets start with an XML document with address information:3243 West 1st Ave.Madison WI 53591 nYou measure the correctness of an XML do

    8、cument by determining two criteria:whether the document is well formed and whether it is valid.7XML SchemanIn order to validate an XML document,you need a way to represent these application-specific constraints.nThe XML Schema for the Address XML document looks like this:8XML SchemanXML Schema built

    9、-in types and their corresponding Java types9XML SchemanBy default,each element declared by a must occur once in an XML document,but you can specify that an element is optional or that it must occur more than once by using the occurrence attributes.For example,we can say that the street element must

    10、 occur once but may occur twice:nBy default,the maxOccurs and minOccurs attributes are always 1,indicating that the element must occur exactly once.10XML SchemanThe declarations are nested under a element,which indicates that the elements must occur in the order they are declared.You can also nest t

    11、he elements under an declaration,which allows the elements to appear in any order.The following shows the AddressType declared with an element rather than a element:11XML SchemanIn addition to declaring elements of XSD built-in types,you can declare elements based on complex types.This is similar to

    12、 how Java class types declare fields that are other Java class types.For example,we can define a CustomerType that uses the AddressType:12XML SchemanAn XML document that conforms to the Customer XSD would look like this:Jones Sara 3243 West 1st Ave.Madison WI 53591 nAt runtime,the XML parser compare

    13、s the document to its schema,ensuring that the document conforms to the schemas rules.If the document doesnt adhere to the schema,it is considered invalid,and the parser produces error messages.13XML NamespacesnIn some cases,its convenient to combine two or more XML markup languages into a single do

    14、cument so that the elements from each markup language can be validated separately using different XML Schema.nTo use different markup languages in the same XML document,you must clearly identify the markup language to which each element belongs.Jones Sara 3243 West 1st Ave.Madison WI 53591 14XML Nam

    15、espacesnThe prefixes are assigned using XML Namespace declarations,which are shown in bold in the previous listing.An XML Namespace declaration follows this format:xmlns:prefix=URI nThe prefix can be anything you like,as long as it does not include blank spaces or any special characters.The URI used

    16、 in the XML Namespace declaration identifies the exact markup language that is employed.It doesnt have to point at a web page or an XML document;it only needs to be unique to that markup language.For example,the XML Namespace used by the Address markup is different from the URL used for the Reservat

    17、ion markup:xmlns:addr=http:/ xmlns:res=http:/ nThe URI in the XML Namespace declaration should match the target namespace declared by the XML Schema.15XML NamespacesnPrefixing every element in an XML document with its namespace identifier is a bit tedious,so the XML Namespace allows you to declare a

    18、 default namespace that applies to all nonprefixed elements.The default namespace is simply an XML Namespace declaration that has no prefix(xmlns=URL).For example,we can use a default name in the Reservation document for all reservation elements:Jones Sara 3243 West 1st Ave.Madison WI 53591 16XML Na

    19、mespacesnWe can apply the scoping rules of namespace to simplify the Reservation document further by allowing the address elements to override the default namespace with their own default namespace:Jones Sara 3243 West 1st Ave.Madison WI 53591 17XML NamespacesnXML Namespaces are URIs that uniquely i

    20、dentify a namespace but do not actually point at a resource.In other words,you dont normally use the URI of an XML Namespace to look something up.Its usually only an identifier.However,you might want to indicate the location of the XML Schema associated with an XML Namespace so that a parser can upl

    21、oad it and use it in validation.This is accomplished using the schemaLocation attribute:Jones Sara 18XML NamespacesnXML Schema also uses XML Namespaces.Lets look at XML Schema for the Address markup language with a new focus on the use of XML Namespaces:19TopicnWeb Services StandardsnWeb Services Ov

    22、erviewnXML Schema and XML NamespacesnSOAP 1.1nWSDL 1.1nUDDI 2.020SOAP 1.1nSOAP 1.1 is simply a distributed object protocol such as DCOM,CORBAs IIOP,and JRMP(the primary transport used by RMI).nSOAP is defined by its own XML Schema and relies heavily on the use of XML Namespaces.Every SOAP message th

    23、at is sent across the wire is an XML document consisting of standard SOAP elements and application data.The use of namespaces differentiates the standard SOAP elements from the application data.Heres a SOAP request message that might be sent from a client to a server:21SOAP 1.1nThe element is the ro

    24、ot of the SOAP message;all other elements are contained by it.Within the element are two direct children:the element and the element.nThe element is generally used for carrying infrastructure data such as security tokens,transaction IDs,routing information,and so on.In the previous example,the eleme

    25、nt is empty,which is not unusual for basic web services.In many cases,we are only interested in exchanging information and not in more advanced issues,such as those relating to security and transactions.Although the element is required,the element is not.From this point forward,the element will be o

    26、mitted from examples.nThe element carries the application information that is being exchanged.In the previous example,the element contains a element,which is the application data.Its an XML document fragment based on the Reservation XSD developed earlier in this chapter.Its called a fragment because

    27、 its embedded inside a SOAP message,instead of standing alone.22Web Services StylesnThe SOAP message in the previous example is a Document/Literal message,which means that the message body is a single XML Schema instance document,and thus the full message can be validated.For this reason,Document/Li

    28、teral is becoming the preferred message style of the web services community.nThe schemaLocation attribute could have been included;its omitted because we assume that the receiver is already familiar with the schema used for that type of SOAP message.nThe other style allowed by the WS-I Basic Profile

    29、 1.1 and supported by EJB 3.0 is RPC/Literal.RPC/Literal represents SOAP messages as RPC calls with parameters and return values,each with its own schema type.The following Java interface defines a single method called makeReservation():public interface TravelAgent public void makeReservation(int cr

    30、uiseID,int cabinID,int customerId,double price);23Web Services StylesnThe makeReservation()method can be modeled as a SOAP message using the RPC/Literal messaging style:23 144 9393 5677.88 nThe first element within the identifies the web services operation being invoked.In this case,its the makeRese

    31、rvation operation.Directly under the element are the parameters of the RPC call,each represented by an element with a value.24Exchanging SOAP Messages with HTTPnSOAP messages are network-protocol agnostic,which means that a SOAP message is not aware of or dependent on the type of network or protocol

    32、 used to carry it.With that said,SOAP is primarily exchanged using HTTP.The reason for using HTTP is simple.nAnother advantage of using HTTP is that SOAP messages can slip through firewalls without any hassles.nYou can use SOAP 1.2 with other protocols,such as SMTP,FTP,and even raw TCP/IP,but HTTP i

    33、s the only protocol for which a binding is currently specified.As a result,EJB 3.0 and Java EE 5 require support for SOAP 1.1 over HTTP 1.1 but not other protocols.25TopicnWeb Services StandardsnWeb Services OverviewnXML Schema and XML NamespacesnSOAP 1.1nWSDL 1.1nUDDI 2.026WSDL 1.1nThe Web Service

    34、Description Language(WSDL)is an XML document used to describe a web service.WSDL is programming-language,platform,and protocol agnostic.nImagine that you want to develop a web services component that implements the following interface:public interface TravelAgent public String makeReservation(int cr

    35、uiseID,int cabinID,int customerId,double price);27WSDL 1.1nA WSDL document that describes the makeReservation()method might look like this:28WSDL 1.1 29WSDL 1.1 30The ElementnThe root element of a WSDL document is the element.Usually,a WSDL document declares all the XML Namespaces used in the root e

    36、lement.In the previous example,the element makes four XML Namespace declarations:nThe default namespace(xmlns=http:/schemas.xmlsoap.org/wsdl/)is the WSDL namespace.nThe xsd prefix is assigned to the XML Schema namespace.nThe titan prefix is assigned to a Titan Cruises URL,which indicates that its an

    37、 XML Namespace belonging to Titan Cruises.This namespace is also the value of the targetNamespace attribute.This attribute is similar to the one used in XML Schema.For example,the element references elements and the element references a element using the target namespace31The and ElementsnThe elemen

    38、t describes the web services operations that are available.An operation can have input,output,and fault messages.JAX-WS,and therefore EJB 3.0,supports two styles of web services messaging:request-response and one-way.nThe TravelAgent is an example of the request-response messaging style:nHere is a w

    39、eb service that supports one-way messaging:32The ElementnIf your service needs any custom types,they are defined in the element,which is the first child of the element.nThe element allows us to declare more complex XML types.For example,instead of declaring each parameter of the makeReservation oper

    40、ation as an individual part,you can combine them into a single structure that serves as the parameter of the operation:33The Element 34The and ElementsnThe element describes the type of encoding used to send and receive messages as well as the protocol on which the SOAP messages are carried.The defi

    41、nition for the travelAgent port type looks like this:35The and ElementsnSimilar to the element,the element contains,and elements.In fact,a binding is specific to a particular:its,and elements describe the implementation details of the corresponding.The previous example used the HTTP protocol with RP

    42、C/Literal-style messaging.The WSDL binding for Document/Literal-style messaging is different:36The and ElementsnThe element describes the Internet address of a web service:37TopicnWeb Services StandardsnWeb Services OverviewnXML Schema and XML NamespacesnSOAP 1.1nWSDL 1.1nUDDI 2.038UDDI 2.0nUniversa

    43、l Description,Discovery,and Integration(UDDI)is a specification that describes a standard for publishing and discovering web services on the Internet.nThe analogy normally used to describe UDDI is that it provides electronic White,Yellow,and Green pages for companies and their web services.You can l

    44、ook up companies by name or identifier(White pages)or by business or product category(Yellow pages).You can also discover information about web services hosted by a company by examining the technical entities of a UDDI registry(Green pages).nNot only does a UDDI registry provide information about we

    45、b services and their hosts,a UDDI repository is itself a web service.nAlthough organizations can set up private UDDI registries,there is a free UDDI registry that anyone can use,called the Universal Business Registry(UBR).This registry is accessed at one of four sites hosted by Microsoft,IBM,SAP,and

    46、 NTT.If you publish information about your company in any one of these sites,the data will be replicated to each of the other three.39企业级应用系统体系架构企业级应用系统体系架构(六)(六)EJB3.0的的Web Service402023-1-6From:OReilly:Enterprise JavaBeans 3.0,5th Edition,May.2006TopicnEJB 3.0:Web Services StandardsnAccessing Web

    47、Services with JAX-RPCnDefining a Web Service with JAX-RPC41Accessing Web Services with JAX-RPCnJAX-RPC provides a client-side programming model that allows you to access web services on other platforms from your EJBs.In other words,by using JAX-RPC,EJBs can access web services across the network hos

    48、ted on both Java and non-Java platforms(Perl,.NET,C+,and so on).There are three APIs for accessing web services:generated stubs,dynamic proxies,and the Dynamic Invocation Interface(DII).nA dynamic proxy is very much like the classic Java RMI or CORBA programming model,where the client accesses a rem

    49、ote service via a remote interface implemented by a network stub.The stub translates calls made on the remote interface into network messages that are sent to the remote service.Its similar to using an EJB remote reference;however,the protocol is SOAP over HTTP rather than CORBA IIOP.42Generating JA

    50、X-RPC Artifacts from WSDLnThe primary interface that describes a JAX-RPC web service is called a service endpoint interface.A JAX-RPC-compliant compiler generates the endpoint interface from a WSDL definition.This interface,when combined with WSDL and definitions,is used to create the dynamic proxy

    展开阅读全文
    提示  163文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:企业级应用系统体系架构WebService课件.ppt
    链接地址:https://www.163wenku.com/p-5201079.html

    Copyright@ 2017-2037 Www.163WenKu.Com  网站版权所有  |  资源地图   
    IPC备案号:蜀ICP备2021032737号  | 川公网安备 51099002000191号


    侵权投诉QQ:3464097650  资料上传QQ:3464097650
       


    【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。

    163文库