The Web service call is a document that incorporates calls to any number of ATG Web services that may exist in the same session. For each Web service, you create an instance of the client stub, call methods on the Web service, and call the Web service itself. These Web service calls are written in C#.

A Simple Call

This Web service call obtains a RepositoryItem by accessing the getRepositoryItem ATG Web service.

using Atg.DotNet.WebService.Repository.GetRepositoryItem;

  // ...

  // create stub instance
  GetRepositoryItemSEIService getItemClientStub = new
  GetRepositoryItemSEIService();
  // assign URL of web service
  getRepositoryItemClientStub.Url =
"http://example.com/repository/generic/getItem/getRepositoryItem";
  // call web service
  string itemXml =
getRepositoryItemClientStub.getRepositoryItem("/nucleus/path/to/repository",
"itemDescriptorName", "repositoryId");
A Complex Call

The following code demonstrates how you would construct a call that uses security controls to restrict the information users can access. Notice that the loginUser Web service establishes the user identity role, which other Web services refer to. Because an instance of a CookieContainer is created in this code and assigned to each Web service stub, all Web services called here exist in the same session.

For brevity these examples omit some details such as a exception handling for the SoapException as well as class syntax.

using System.Net; // for CookieContainer
using Atg.DotNet.WebService.Repository.GetItem;
using Atg.DotNet.WebService.Repository.PerformRQLQuery;
using Atg.DotNet.WebService.UserSession.LoginUser;
using Atg.DotNet.WebService.UserSession.LogoutUser;

// create stub instances
GetItemSEIService getItemClientStub = new GetItemSEIService();
PerformRQLQuerySEIService performRQLQueryClientStub = new
PerformRQLQuerySEIService();
LoginUserSEIService loginUserClientStub = new LoginUserSEIService();
LogoutUserSEIService logoutUserClientStub = new
LogoutUserSEIService();

// create a new cookie container for our session and share it between
// the various stub instances
CookieContainer cookieContainer = new CookieContainer();
getItemClientStub.CookieContainer = cookieContainer;
performRQLQueryClientStub.CookieContainer = cookieContainer;
loginUserClientStub.CookieContainer = cookieContainer;
logoutUserClientStub.CookieContainer = cookieContainer;

// authenticate the user for the session
loginUserClientStub.loginUser("user", "password", false);

// call services
string itemXml =
getItemClientStub.getItem("/nucleus/path/to/repository",
"itemDescriptorName", "repositoryId");
string[] itemsXml =
performRQLQueryClientStub.performRQLQuery("/nucleus/path/to/repository",
"itemDescriptorName", "property = 'value'");

// log out the user
logoutUserClientStub.logoutUser();
 
loading table of contents...