WebService概念和术语一.WebService基本的概念XML(eXtensibleMarkupLanguage)XMLisusedtoorganizedocumentsandbusinessdata.XMLfilescanbestoredortransmittedbetweentwoapplicationsonanetwork.Basically,theyarejustplaintextdocumentsthatcontainspecialtagsthatlabeldifferentpartsofadocumentorfieldsofdata.XML是一种由规范定义的元语言。XML标记语言定义了一套用来组织和描述文本的标记(tag)。标记通常成对出现,其中一个标记是开始标记,另一个标记是结束标记。位于这两个标记之间的所有内容均成为元素。SOAP(SimpleObjectAccessProtocol)SOAPdefinesastandardpackagingformatfortransmittingXMLdatabetweenapplicationsonanetwork.ASOAPmessageisjustanXMLdocument.SOAPisspeciallydesigned,however,tocontainandtransmitotherXMLdocumentsaswellasinformationrelatedtorouting,processing,security,transactions,andotherqualitiesofservice.SOAP消息是一种XML文档,它有其自己的XML模式、命名空间和处理规则。目前的版本是SOAP1.2。WSDL(WebServicesDescriptionLanguage)WSDLisastandardfordescribingthestructureoftheXMLdataexchangedbetweentwosystemsusingSOAP.WSDL是一个用于精确描述Web服务的文档格式,它用来指定客户与具体的Web服务通信时必须使用的确切的消息格式、Internet协议以及地址。目前的版本是WSDL2.0UDDI(UniversalDescription,Discovery,andIntegration)UDDIdefinesastandardsetofWebserviceoperations(methods)thatareusedtostoreandlookupinformationaboutotherWebserviceapplications.Inotherwords,UDDIdefinesastandardSOAP-basedinterfaceforaWebservicesregistry.YoucanuseaUDDIregistrytofindaparticulartypeofWebservice,ortofindoutabouttheWebserviceshostedbyaspecificorganization.AUDDIregistryisoftenreferredtoasaYellowPagesforWebservices.TheUDDIspecificationisnowmaintainedbytheOrganizationfortheAdvancementofStructuredInformationStandards(OASIS)UDDI定义了一套标准的Web服务操作方法,用于存储、查找有关其他Web服务应用程序方面的信息。WS-IBP(WebServicesInteroperabilityBasicProfile)WebServicesInteroperabilityOrganizationisanorganizationofWebservicesvendorsthatarecommittedtodefiningastandardforWebservicesinteroperability.ThefirstdeliverableoftheWS-IwastheBasicProfile1.0,第二个是WS-IBasicProfile2.0二.WebServiceAdvanced概念WS-AddressingWS-AddressingspecificationistoprovidethemeanstoidentifyaWebserviceendpointandawaytousesuchidentifiersinSOAPmessagesforthedeliveryandexchangeofmessagesbetweenWebserviceprovidersandWebservicerequesters.WS-Addressing通过对SOAP消息的扩展,为WebServices的寻址问题提供更强大的支持。WS-Addressing规范主要描述了两个概念:EndpointReference以及MessageAddressingProperties。在WebServices中代表一类逻辑功能的服务实现可能存在不同的Endpoint,每一个Endpoint可能代表了一种不同的绑定方式,甚至对外表现出不同的接口,比如EndpointA可能使用TCP协议通讯,而EndpointB则可能使用Http协议。通过EndpointReferrence我们就可以引用到相应的Endpoint上,从而访问该服务。MessageAddressingProperties作为SOAPHead的扩展将包含在每一个SOAP消息中,用于该消息的寻址。WS-PolicyWS-Policydefinesageneral-purposeframeworkforrepresentingandcombiningstatementsaboutthequalityofserviceproperties.WS-Policyisanextensibleframeworkthatcanaccommodatedomain-specificdialectstorepresenttheseassertionsandallowtheattachmentofpoliciestoarbitrarytypesofsubjectsthoughthegenericattachmentmechanismsthatWS-PolicyAttachmentsdefine.Web服务策略框架规范(WebServicesPolicyFramework,WS-Policy)提供了一种灵活、可扩展的语法,用于表示基于XMLWebservices的系统中实体的能力、要求和一般特性。WS-Policy定义了一个框架和一个模型,将这些特性表示为策略。策略表示法既支持简单的声明式断言,也支持比较复杂的条件式断言。策略断言是要表示行为的个体要求、能力或其他特性。例如,可以创建一个策略断言,定义这样一个要求:必须使用受信任的X.509证书签名SOAP消息主体。WS-Policy提供了一个通用模型和语法,用于描述Web服务的策略及就此进行沟通。WS-Policy断言说明特定Web服务的功能和约束。WS-PolicyAttachments定义了用于将WS-Policy表达式与Web服务(即WSDL)关联的若干方法。WS-ReliableMessagingWS-ReliableMessagingpromisestobringthebenefitsofreliablemessagingtoSOAandWebservices,enablingenterprisestoextendWebservicestosupportreliablebusiness-to-business(B2B)exchanges.WS-Coordination(WS-ATandWS-BA)WSAtomicTransactionsApplicationoperationsonWebservicesoccurcompletelyornotatall,andresultsarenotavailableuntilthetransactioniscomplete.WSBusinessActivityApplicationoperationsonWebservicesexhibitalooseunitofwork,inwhichresultsaresharedpriortocompletionoftheoverallactivity.Eachparticipantundoestheoperationsithasperformedwithintheconversation.WS-CoordinationspecificationprovidesthegenericfoundationforcoordinatingoutcomeagreementsbetweeninteroperatingWebservices.WS-AtomicTransactionandWS-BusinessActivityspecificationscontaindefinitionsofatomicandbusinesstransactionprotocols,respectively,thatyoucanusewithWS-Coordination.WS-Coordinationisdefinedasanextensibleframeworkthatcansupportadditionalprotocolsforothercoordinationpatternsasrequired.WS-ATandWS-BA用来定义规范WS的事务。WS-SecurityWS-SecuritySOAPMessageSecurityisoptimizedforexchangingasmallnumberofmessages.ArequestermightengageinaprolongedconversationwithaWebservice.WS-SecureConversationbuildsonWS-Trustandmessagesecuritytoprovidesupportformultimessage,long-livedconversations.WS-SecureConversationprovidesabetterlevelofsecurityandimprovedefficiency.ThischapteralsoprovidesanoverviewofWS-SecureConversation.WS-TrustWS-Securitysupportssecuritytokens.Collaborationbetweenenterprisesoftenrequiressharingadditionalinformation,suchascustomeridentityinformationandpreferences.WS-FederationextendsWS-Trusttoprovidethesefunctions,andisdiscussedlaterinthischapter.WS-Authorization/WS-PrivacyWS-AuthorizationandWS-Privacyareinprogress.WS-BPELWebservicesBusinessProcessExecutionLanguageisanextensibleworkflow-basedlanguagethataggregatesservicesbychoreographingserviceinteractions.Theaggregationisrecursive,suchthattheprocessexpos