WS-ServiceGroup协议
WS-ServiceGroup协议定义了ServiceGroup的概念,它使得我们可以根据各种规则,将 Web 服务和 WS-Resources 成组在一起。
以下是WS-ServiceGroup协议中的几个重要定义:
l Member:
A Web service that belongs to a ServiceGroup. Note, this Web service may be a component of a WS-Resource as defined in “Web Services Resources” [WS-Resource].
l ServiceGroup:
A Web service that is a collection of other Web services or WS-Resources and the information that pertains to them. The purpose of the group is application domain specific. The means by which the membership in the ServiceGroup is formed may be through ServiceGroupRegistration, or through other means not defined by this specification.
l ServiceGroupEntry:
An atomic entry in a ServiceGroup which associates a member to a ServiceGroup. A ServiceGroupEntry also contains content information by which the member’s participation in the ServiceGroup is advertised.
l ServiceGroupRegistration:
A ServiceGroup that provides the means to allow users of the service to explicitly insert new members.
一旦应用程序变得足够大而复杂,就应该将资源成组在一起。您可能想要基于用户或服务角色来限制访问,或者您想要提供可用服务的注册表。不管是什么原因,WSRF 都通过使用 ServiceGroup 来处理问题。ServiceGroup 是一个 WS-Resource,它将指向其他 WS-Resources 和纯 Web 服务的指针成组在一起。
ServiceGroup 是一个 WS-Resource。这对于我们来说意味着几件事情。首先,它意味着 ServiceGroup 是 Web 服务与有状态资源的组合。在这种情况下,有状态资源是 ServiceGroup 包含的项的组合,因为它是 WS-Resource,所以这个项组合是由 ServiceGroup 的资源属性文档表示的。
它还意味着 ServiceGroup 是由端点引用识别的,我们可以通过后者来引用前者,并且我们可以在 ServiceGroup 上执行可以在任何其他 WS-Resource 上执行的相同操作,比如创建或销毁它,或者访问它的属性。
协议中的定义如下:
A ServiceGroup is a WS-Resource and MUST comply with the definition of a WS-Resource in [WS-Resource]; the ServiceGroup represents a collection of other Web services. The individual services represented within the ServiceGroup are the ServiceGroup’s members, or its membership. The model for membership of a ServiceGroup is an entry resource property of the ServiceGroup. An entry WS-Resource also represents an association with a given member in the ServiceGroup and is used to manage the membership relationship. Additionally a ServiceGroup has the following characteristics:
l When a ServiceGroup WS-Resource is destroyed, all of the ServiceGroupEntry WS-Resources are also RECOMMENDED to be destroyed. Note however, that the actual member Web services or WS-Resources are not affected.
l Once a ServiceGroup is destroyed, a requestor MUST make no assumptions about either the existence of the entry WS-Resources or the validity of the contents of those WS-Resources.
l A member MAY belong to several ServiceGroups.
l A member MAY belong to the same ServiceGroup more then once.
l The member of a ServiceGroup MAY implement message exchanges from various interfaces.
l If a member WS-Resource is destroyed, the ServiceGroup MAY destroy the corresponding entry WS-Resource.
l A ServiceGroupEntry in isolation has no semantic meaning.
创建 ServiceGroup
使用 ServiceGroup 的第一步是创建它。因为 ServiceGroup 就是一个 WS-Resource,所以我们就像创建其他 WS-Resource 一样用一个 Create 消息来创建它:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<createSatGroup xmlns="http://example.com/satellite"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
跟前面一样,响应包含对新 WS-Resource 的端点引用:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<createSatGroupResponse xmlns="http://example.com/satellite">
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address> http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupId>SATGRP3</sat:SatGroupId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</createSatGroupResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
好的,那么我们真正具有了什么呢?到目前为止,我们总是从定义 WS-Resource 的资源属性文档开始,但是我们在这里不是这样做的,因为它已经为我们定义好了,正如您下面就会看到的。
ServiceGroup ResourceProperties
ServiceGroup 的资源属性文档定义在 WS-ServiceGroup.wsdl 文件中,所以我们无须定义它。实际上,实际的文档类似于下面这样:
<wssg:ServiceGroupRP>
<wssg:MembershipContentRule MemberInterface="sat:AuditedSatellitePortType" />
<wssg:MembershipContentRule MemberInterface="sat:CounterPortType"
ContentElements="sat:audited" />
<wssg:MembershipContentRule ContentElements="sat:approvedBy" />
<wssg:Entry>...</wssg:Entry>
<wssg:Entry>...</wssg:Entry>
</wssg:ServiceGroupRP>
我们马上就会在 ServiceGroup Entry 元素一节中谈论 Entry 元素。
我们将从 MembershipContentRule 元素开始。这些元素定义 ServiceGroupEntry 在可以被添加到 ServiceGroup 之前必须满足的条件。
MemberInterface 属性列出一系列PortType,所有实现了这些PortType的成员都必须满足此成员规则。
第二个属性,即 ContentElements,指定必须包含在 ServiceGroupEntry 的 Content 元素中的元素。我们在了解 ServiceGroupEntry 时再来详细了解这一点。
以下是协议中的定义:
The general form of a MembershipContentRule resource property element is:
<wsrf-sg:MembershipContentRule
MemberInterfaces="list of QName"?
ContentElements="list of QName"
/>
This resource property element is further constrained as follows:
/wsrf-sg:MembershipContentRule
The MembershipContentRule constrains the ServiceGroup membership to those members that implement the interfaces described below in /wsrf-sg:membershipContentRule/@MemberInterfaces if present. A MembershipContentRule is further satisfied according to the rules defined below in wsrf-sg:membershipContentRule/@ContentElements.
/wsrf-sg:membershipContentRule/@MemberInterfaces
This optional attribute, when present, specifies the members to which this MembershipConentRule applies according to the interface (WSDL 1.1 portType) of the member Web service.
A MembershipContentRule applies to a member if, for each QName in the value of @MemberInterfaces, there is a corresponding interface (WSDL 1.1 portType) of the member Web service whose name matches that QName. Two QNames are equivalent when they have the same local part and they have prefixes which have been bound to namespace names that are identical [XML-Names]. If this attribute is not present, all members MUST satisfy the enclosing MembershipContentRule’s @ContentElements constraint.
/wsrf-sg:membershipContentRule/@ContentElements
This attribute specifies the content restrictions according to the list of QNames, each of which refer to a XML Schema global element declaration. This list defines the constraints on the wsrf-sg:Content resource property of the ServiceGroupEntry that MUST be satisfied for membership. The list MAY be an empty list. When an empty list is specified there are no content constraints on the resource properties of the ServiceGroupEntries that match the enclosing MembershipContentRule.
A member satisfies a MembershipContentRule if, for each QName in the value of @ContentElements, there is at least one child element of the wsrf-sg:Content of the ServiceGroupEntry’s resource properties document whose name matches that QName. Two QNames are equivalent when they have the same local part and they have prefixes which have been bound to namespace names that are identical [XML-Names].
Note: It is possible to construct a MembershipContentRule without a MemberInterface and with an empty list for the ContentElements. Such a MembershipContentRule would have no effect on the membership as per the normative semantics described for this component.
ServiceGroupEntry 也是一个 WS-Resource,所以它也具有定义其状态的资源属性文档和识别它的 WS-Address。它定义 ServiceGroup 和服务之间的关系,并包含可选内容,所以资源属性文档类似于下面这样:
<wssg:ServiceGroupEntryRP>
<wssg:ServiceGroupEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupId>SATGRP3</sat:SatGroupId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:ServiceGroupEPR>
<wssg:MemberEPR>
<wsa:EndpointReference xmlns:wsa=http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT9928</sat:SatelliteId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:MemberEPR>
<wssg:Content>
<sat:approvedBy>BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:ServiceGroupEntryRP>
ServiceGroupEPR 是对 ServiceGroup 的端点引用,而 MemberEPR 引用实际的 Web 服务或 WS-Resource。ServiceGroupEntry 也引用实际的 Web 服务或 WS-Resource。
Content 元素是可以包含在 ServiceGroupEntry 中的附加信息。在本例中,我们添加了一个批准代码,指出服务即使没有实现 CounterPortType 或 AuditedSatellitePortType portTypes 也可以被添加到组中。
ServiceGroup资源属性文档中的Entry 元素
现在我们可以回过头来看 ServiceGroup 的资源属性文档中的 Entry 元素。在本例中,每一项识别 ServiceGroupEntry 资源并提供到实际服务的指针,所以 ServiceGroup 的资源属性文档类似于下面这样:
<wssg:ServiceGroupRP>
<wssg:MembershipContentRule MemberInterface="sat:AuditedSatellitePortType" />
<wssg:MembershipContentRule MemberInterface="sat:CounterPortType"
ContentElements="sat:audited" />
<wssg:MembershipContentRule ContentElements="sat:approvedBy" />
<wssg:Entry>
<wssg:ServiceGroupEntryEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupEntryId>SATGRPENTRY28981</sat:SatGroupEntryId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:ServiceGroupEntryEPR>
<wssg:MemberServiceEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT9928</sat:SatelliteId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:MemberServiceEPR>
<wssg:Content>
<sat:approvedBy>BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:Entry>
<wssg:Entry>
<wssg:ServiceGroupEntryEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupEntryId>SATGRPENTRY29003</sat:SatGroupEntryId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:ServiceGroupEntryEPR>
<wssg:MemberServiceEPR>
<wsa:EndpointReference xmlns:wsa=http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT8557</sat:SatelliteId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:MemberServiceEPR>
<wssg:Content>
<sat:approvedBy> BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:Entry>
</wssg:ServiceGroupRP>
ServiceGroupEntryEPR 指向我们在前一节(ServiceGroupEntries)中看到的 ServiceGroupEntry 对象,而 MemberServiceEPR指向添加到ServiceGroup的实际服务或WS-Resource。Content 元素展示 ServiceGroupEntry 中的 Content 元素。
然而,回到我们的例子,我们还只创建了这个 ServiceGroup,所以需要添加所有这些信息,下面我们从 MembershipContentRules 开始。
添加 MembershipContentRules
一旦创建了 ServiceGroup,我们就可以添加一个或多个 MembershipContentRule。因为它们是 ServiceGroup 的资源属性的一部分,所以我们利用 Insert 消息来添加:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wssg=""http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>
http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/SetResourceProperties
</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/satellite</wsa:To>
<sat:SatGroupId>SATGRP3</sat:SatGroupId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:SetResourceProperties xmlns:satProp="http://example.com/satellite">
<wsrp:Insert>
<wssg:MembershipContentRule MemberInterface="sat:AuditedSatellitePortType" />
</wsrp:Insert>
<wsrp:Insert>
<wssg:MembershipContentRule MemberInterface="sat:CounterPortType"
ContentElements="sat:audited" />
</wsrp:Insert>
<wsrp:Insert>
<wssg:MembershipContentRule ContentElements="sat:approvedBy" />
</wsrp:Insert>
</wsrp:SetResourceProperties>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
这里,我们把消息发送到了 ServiceGroup WS-Resource,并添加了匹配我们在 ServiceGroup ResourceProperties 一节中看到过的规则的属性。服务器返回一个确认更改的 SetResourcePropertiesResponse 消息:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>
http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/SetResourcePropertiesResponse
</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/myClient</wsa:To>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:SetResourcePropertiesResponse></wsrp:SetResourcePropertiesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
现在 ServiceGroup 本身已经准备就绪,我们可以开始添加项了。
添加新的项
为了向 ServiceGroup 添加项,我们需要对服务或 WS-Resource 的端点引用。还需要任何相关 Content。例如,我们可以将人造卫星 SAT8557 添加到 ServiceGroup:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wssg=""http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>http://docs.oasis-open.org/wsrf/2004/06/WS-ServiceGroup/Add</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/satellite</wsa:To>
<sat:SatGroupId>SATGRP3</sat:SatGroupId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wssg:Add>
<wssg:MemberEPR>
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT8557</sat:SatelliteId>
</wsa:ReferenceProperties>
</wssg:MemberEPR>
<wssg:Content>
<sat:approvedBy>BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:Add>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
这里,我们指定了对服务的端点引用和任何所需的 Content。您也可以添加 InitialTerminationTime 元素,为生成的 ServiceGroupEntry 指定一个 TerminationTime。
在响应中,服务器发送对新 ServiceGroupEntry 的端点引用:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>http://docs.oasis-open.org/wsrf/2004/06/WS-ServiceGroup/AddResponse</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/myClient</wsa:To>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:AddResponse>
</wsa:EndpointReference>
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupEntryId>SATGRPENTRY29003</sat:SatGroupEntryId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wsrp:AddResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我们可以添加任意多的资源,只要它们不违反任意一个 MembershipContentRule。
至此,我们已经向 ServiceGroup 添加了 MembershipContentRule 和一个或多个项,所以资源属性文档跟 ServiceGroup Entry 元素 一节中的类似。现在我们来看检索信息。
例如,假设我们想要计数恒星的个数。ServiceGroup 包含大量我们可以使用的 WS-Resources。如果我们只需要其中之一,最简单的方法是使用 GetResourceProperty 消息:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wssg="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>
http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/GetResourceProperty
</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/satellite</wsa:To>
<sat:SatGroupId>SATGRP3</sat:SatGroupId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:GetResourceProperty>wssg:Entry</wsrp:GetResourceProperty>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
响应包含一个 Entry 元素:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>
http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/GetResourcePropertyResponse
</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/myClient</wsa:To>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:GetResourcePropertyResponse>
<wssg:Entry>
<wssg:ServiceGroupEntryEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupEntryId>SATGRPENTRY28981</sat:SatGroupEntryId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:ServiceGroupEntryEPR>
<wssg:MemberServiceEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT9928</sat:SatelliteId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:MemberServiceEPR>
<wssg:Content>
<sat:approvedBy>BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:Entry>
</wsrp:GetResourcePropertyResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
该元素包含 MemberServiceEPR,而后者是对服务或 WS-Resource 的端点引用。一旦有了该引用,我们就可以像第1部分中那样使用服务或 WS-Resource 了。不管是从CreateResponse还是 GetResourcePropertyResponse 收到端点引用,之间没有什么区别。我们有了一个端点引用,所以可以使用它所代表的服务或 WS-Resource 了。
检索多个项
在 第 1 部分 中,我们使用了 QueryResourceProperties 消息来查询属性,但是我们也可以使用它来检索多个具有相同名称的属性。例如,我们可以检索 ServiceGroup 的所有 Entry 元素:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wssg="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>
http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/QueryResourceProperties
</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/satellite</wsa:To>
<sat:SatGroupId>SATGRP3</sat:SatGroupId>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:QueryResourceProperties>
<wsrp:QueryExpression Dialect="http://www.w3.org/TR/1999/REC-xpath-19991116">
/*/Entry
</wsrp:QueryExpression>
</wsrp:QueryResourceProperties>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
响应包含所有的 Entry 属性:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sat="http://example.org/satelliteSystem"
xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wssg="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd">
<SOAP-ENV:Header>
<wsa:Action>
http://docs.oasis-open.org/wsrf/2004/06/WS-ResourceProperties/QueryResourcePropertiesResponse
</wsa:Action>
<wsa:To SOAP-ENV:mustUnderstand="1">http://example.com/myClient</wsa:To>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsrp:GetResourcePropertyResponse>
<wssg:Entry>
<wssg:ServiceGroupEntryEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupEntryId>SATGRPENTRY28981</sat:SatGroupEntryId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:ServiceGroupEntryEPR>
<wssg:MemberServiceEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT9928</sat:SatelliteId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:MemberServiceEPR>
<wssg:Content>
<sat:approvedBy>BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:Entry>
<wssg:Entry>
<wssg:ServiceGroupEntryEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatGroupEntryId>SATGRPENTRY29003</sat:SatGroupEntryId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:ServiceGroupEntryEPR>
<wssg:MemberServiceEPR>
<wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/02/addressing"
xmlns:sat="http://example.org/satelliteSystem">
<wsa:Address>http://example.com/satellite</wsa:Address>
<wsa:ReferenceProperties>
<sat:SatelliteId>SAT8557</sat:SatelliteId>
</wsa:ReferenceProperties>
</wsa:EndpointReference>
</wssg:MemberServiceEPR>
<wssg:Content>
<sat:approvedBy>BossManBing</sat:approvedBy>
</wssg:Content>
</wssg:Entry>
</wsrp:QueryResourcePropertiesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我们也可以使用 XPath 表达式来限制检索的 Entry。例如,我们可以只检索具有 audited 元素的项。一旦有了响应,我们可以使用客户机应用程序来查找每一个 Entry 并使用由每个 MemberServiceEPR 表示的服务。
删除 ServiceGroupEntries 和 ServiceGroups
我们已经向 ServiceGroup 添加了一个服务,但是该如何删除它呢?答案在于 ServiceGroupEntry 以及它是 WS-Resource 这样一个事实。要从 ServiceGroup 删除服务,只要检索对 ServiceGroupEntry 的端点引用,并使用该引用来发送 Destroy 消息即可。在这种情况下,您只是破坏了资源和组之间的链接。如果您销毁资源,就应该也销毁指向该资源的任何 ServiceGroupEntry 对象。
类似地,如果您销毁 ServiceGroup,就应该也销毁它包含的所有 ServiceGroupEntry 资源。
Author: orangelizq
email: orangelizq@163.com
posted on 2009-07-19 15:51
桔子汁 阅读(374)
评论(0) 编辑 收藏 所属分类:
Web Service