It’s time to show you how to create .NET remote client for HelloWorldService.

In order to create .NET proxies for DFS service, developers should have:

  • Service’s WSDL URL.
  • DFS service-model.xml file which describes service artifacts to be generated by subsequent processes.

The data above is required for DFS Proxy Generator tool which creates .NET DFS proxy:

DFS Proxy Generator

After creation of proxy, it can be used for service instantiation and invocation.

Below is source code which creates and invokes HelloWorldService. As I said in my previous post DFS 6.0 SP1 is coming, Java and .NET DFS API’s are very similar to each other, there is no conceptual differences between them.

Source code:

using System;
using Client.Service;
using Emc.Documentum.FS.DataModel.Core.Context;
using Emc.Documentum.FS.Runtime.Context;

namespace Client
{
class Program
{
static void Main(string[] args)
{
string moduleName = “example”;
string contextRoot = “http://localhost:7001/services”;

ContextFactory contextFactory = ContextFactory.Instance;
IServiceContext context = contextFactory.NewContext();
RepositoryIdentity repoId = new RepositoryIdentity();
repoId.RepositoryName = “yourreponame”;
repoId.UserName = “yourusername”;
repoId.Password = “yourpwd”;

context.AddIdentity(repoId);

// Remote service invocation
IHelloWorldService mySvc;
try
{
context = contextFactory.Register(context, moduleName, contextRoot);
ServiceFactory serviceFactory = ServiceFactory.Instance;
mySvc = serviceFactory.GetRemoteService<IHelloWorldService>(context, moduleName, contextRoot);
string response = mySvc.SayHello(”John”);
Console.WriteLine(”response = ” + response);
}
catch (Exception e)
{
Console.Error.WriteLine(e.StackTrace);
}
}
}
}

This sample is also included in helloworldservice.zip.

P.S: Please note, that DFS SP1 is required in order to build this sample.