This section describes the components you need in order to call a Web Service. Because there are a few ways that you can generate a Web Service call on .NET, this section focuses only on the Oracle Commerce Platform resources you will use and assumes that you will refer to your .NET documentation for specific instructions.

The following sections should provide guidance when creating a Web Service call:

Accessing a Web Service

The Oracle Commerce Platform provides client stubs for all Web Services in ATGWS.dll. Once you have installed a version of ATGWS.dll to your GAC and Assembly folders (see Installing ATGWS.dll for instructions), you need to do two things:

  1. In your Visual Studio .NET project, make a reference to ATGWS.dll.

  2. Create instances of the client stubs and use them in your Web Service call.

Accessing a Custom Web Service

To access a Web Service that you created in the Oracle Commerce Platform, you create client stub and a reference to it in your Visual Studio.NET project:

Sample Web Service Calls

The Web Service call is a document that incorporates calls to any number of 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#.

Simple Call Example

This Web Service call obtains a RepositoryItem by accessing the getRepositoryItem 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"http://example.com/repository/generic/getItem/getRepositoryItem
Complex Call Example

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();

Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices