javascript
Brief description  about Online courses   join in Online courses
OR

Creating the Service Group and Adding Members

Jayadeep  Mathew
Jayadeep Mathew
Senior Software Developer

The first step in creating our Service Group is to create a new auction manager service and add the ServiceGroup port type using the [WSRFPortType] attribute. We will also add the GCGResourceFactory port type as well as the ImmediateResourceTermination port type to make the job of managing the lifetime of this Resource easier. Finally, in order to query the Service Group for its members, we need to have access to its member’s Resource Properties so we add the QueryResourceProperties port type as well. Create a new C# Web Service item in your AuctionServices project and call it AuctionManager.asmx (the code for AuctionManager.asmx is shown in Code Example 26). As before, you must make sure that the WSRF property on the new project item is set to true.

The AuctionManager Service

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using UVa.GCG.WSRF.Common.Attributes;

using UVa.GCG.WSRF.Service.BaseTypes;

using UVa.GCG.WSRF.Service.Grid;

using UVa.GCG.WSRF.Service.ResourceLifetime;

using UVa.GCG.WSRF.Service.ResourceProperties;

using UVa.GCG.WSRF.Service.ServiceGroup;

namespace AuctionServices

{

[WsdlBaseName("AuctionManager",

"http://wsrfnet.cs.virginia.edu/auction-tutorial")]

[WebService]

[WebServiceBinding]

[WSRFPortType(typeof(ServiceGroupRegistrationPortType))]

[WSRFPortType(typeof(GCGResourceFactoryPortType))]

[WSRFPortType(typeof(ImmediateResourceTerminationPortType))]

[WSRFPortType(typeof(QueryResourcePropertiesPortType))]

public class AuctionManager : ServiceSkeleton

{

public AuctionManager()

{

InitializeComponent();

}

 

#region Component Designer generated code

#endregion

}

}

Just as the Notification Producer service used a Subscription Manager service to manage information it needed, services implementing the Service Group port type use an additional service to manage the references to the Service Group members. This service must have a ServiceGroupEntry port type and for WSRF.NET it is also required to have both GCGResourceFactory port type as well as ImmediateResourceTermination port type. Once again, create a new project item which is a C# Web Service (don’t forget to mark the WSRF property for this item as true) and call the new item AuctionManagerEntry.asmx. See Code Example 27 below for the code.

 AuctionManagerEntry Service

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using UVa.GCG.WSRF.Common.Attributes;

using UVa.GCG.WSRF.Service.BaseTypes;

using UVa.GCG.WSRF.Service.Grid;

using UVa.GCG.WSRF.Service.ResourceLifetime;

using UVa.GCG.WSRF.Service.ServiceGroup;

namespace AuctionServices

{

[WsdlBaseName("AuctionManagerEntry",

"http://wsrfnet.cs.virginia.edu/auction-tutorial")]

[WebService]

[WebServiceBinding]

[WSRFPortType(typeof(ServiceGroupEntryPortType))]

[WSRFPortType(typeof(GCGResourceFactoryPortType))]

[WSRFPortType(typeof(ImmediateResourceTerminationPortType))]

public class AuctionManagerEntry : ServiceSkeleton

{

public AuctionManagerEntry()

{

InitializeComponent();

}

#region Component Designer generated code

#endregion

}

}

The last service-side change that you have to make in order to start adding auctions to your new manager is to configure the manager so that it can locate the Service Group Entry port type. This is very similar to the configuration changes that you made to the web.config file before in order to set the Subscription Manager URL for the Notification Producer. Once again, open the web.config file and edit the file as shown in Code Example 28.

Configuring the ServiceGroup Port Type

<wsrf-config>

<services>

<service name="Auction.asmx">

<parameter name="SubscriptionManagerURL" value="%transport-protocol%://%machine-name%/%service-base-path%/SubscriptionManager.asmx"/>

</service>

<service name="AuctionManager.asmx">

<parameter name="ServiceGroupEntryURL" value="%transport-protocol%://%machine-name%/%service-base-path%/AuctionManagerEntry.asmx"/>

</service>

</services>

</wsrf-config>

</wsrf-config>

Write your comment now