The Web Service call is a document that incorporates calls to any number of Oracle ATG Web Commerce 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 Oracle ATG Web Commerce 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();