Latest post Wed, Apr 16 2014 10:01 PM by robg. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • Wed, Jan 8 2014 4:35 PM

    • robg
    • Top 500 Contributor
    • Joined on Fri, Nov 4 2005
    • Tewksbury, MA
    • Posts 494
    • Points 5,605
    • Avid Developer Moderator
      Avid Employee

    Tutorial: Calling Into Interplay Production WS from .NET Clients

    Greetings,

    I got a couple of requests recently for Visual Basic or C# sample code for calling into Interplay Production Web Services.

     

    Here's what a Search() call looks like in VB

    Imports InterplayWSClientTest.InterplayWS

    Module Module1

        Sub Main()

            Console.WriteLine("Interplay WS Test")

            Dim port As New AssetsPortTypeClient()

            Dim creds As New UserCredentialsType()

            creds.Username = "username"

            creds.Password = "password"

            Dim param As New SearchType()

            param.InterplayPathURI = "interplay://WGC/Projects/rob's project/rob's project Bin/"

            param.SearchGroup = New SearchGroupType()

            param.SearchGroup.[Operator] = "AND"

            param.SearchGroup.AttributeCondition = New AttributeConditionType(0) {}

            param.SearchGroup.AttributeCondition(0) = New AttributeConditionType()

            param.SearchGroup.AttributeCondition(0).Condition = "EQUALS"

            param.SearchGroup.AttributeCondition(0).Attribute = New AttributeType()

            param.SearchGroup.AttributeCondition(0).Attribute.Name = "Type"

            param.SearchGroup.AttributeCondition(0).Attribute.Group = "SYSTEM"

            param.SearchGroup.AttributeCondition(0).Attribute.Value = "masterclip"

            Dim response As SearchResponseType = port.Search(creds, param)

            If response.Results.Length > 0 Then

                For Each ad As AssetDescriptionType In response.Results

                    Console.WriteLine(ad.InterplayURI)

                    For Each att As AttributeType In ad.Attributes

                        Console.WriteLine(att.Group + "." + att.Name + " = " + att.Value)

                    Next

                    Console.WriteLine()

                Next

            Else

                Console.WriteLine("No records found")

            End If

            Console.ReadLine()

        End Sub

    End Module

     

    Here's the same logic in C#

     

    using System;

    using InterplayWSClientTest.InterplayWS;

    namespace InterplayWSCSharpTest

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.WriteLine("Interplay WS Test");

                AssetsPortTypeClient port = new AssetsPortTypeClient();

                UserCredentialsType creds = new UserCredentialsType();

                creds.Username = "username";

                creds.Password = "password";

                SearchType param = new SearchType();

                param.InterplayPathURI = "interplay://WGC/Projects/rob's project/rob's project Bin/";

                param.SearchGroup = new SearchGroupType();

                param.SearchGroup.Operator = "AND";

                param.SearchGroup.AttributeCondition = new AttributeConditionType[1];

                param.SearchGroup.AttributeCondition[0] = new AttributeConditionType();

                param.SearchGroup.AttributeCondition[0].Condition = "EQUALS"; 

                param.SearchGroup.AttributeCondition[0].Attribute = new AttributeType();

                param.SearchGroup.AttributeCondition[0].Attribute.Name = "Type";

                param.SearchGroup.AttributeCondition[0].Attribute.Group = "SYSTEM";

                param.SearchGroup.AttributeCondition[0].Attribute.Value = "masterclip";

                SearchRequest request = new SearchRequest();

                request.UserCredentials = creds;

                request.Search = param;

                SearchResponseType response = port.Search(creds, param);

                if (response.Results.Length > 0)

                {

                    foreach (AssetDescriptionType ad in response.Results)

                    {

                        Console.WriteLine(ad.InterplayURI);

                        foreach (AttributeType att in ad.Attributes)

                        {

                            Console.WriteLine(att.Group + "." + att.Name + " = " + att.Value);

                        }

                        Console.WriteLine();

                    }

                }

                else

                    Console.WriteLine("No records found");

                Console.ReadLine();

            }

        }

    }

     

    Note that you will have to do these things to get this running at your site:

    1. Use Visual Studio to create a console project called InterplayWSClientTest
    2. Copy in the source (into Module1.vb for Visual Basic or Program.cs for C#)
    3. In the project, use Configure Service Reference to point to your Interplay Production WS system
    4. Change the username and password in the code to valid credentials
    5. Change the Interplay Path to a folder in your Interplay that has some master clips
    If anyone would like the project/solution files, please request it in a reply to this post, noting the language and Visual Studio version, and I'll upload it to this thread. Cheers, - Rob

     

  • Tue, Apr 15 2014 8:28 PM In reply to

    • xudon
    • Not Ranked
    • Joined on Tue, Apr 15 2014
    • Posts 14
    • Points 180

    Re: Tutorial: Calling Into Interplay Production WS from .NET Clients

    Hi, robg

    Thanks for the post! I'm new to dotnet web services. Could you tell me how to code in vb.net for infrastructure services so I can get configuration or version info back? I tried different syntax and none of them works.

    Thank you very much for the help!

    Don

  • Wed, Apr 16 2014 10:01 PM In reply to

    • robg
    • Top 500 Contributor
    • Joined on Fri, Nov 4 2005
    • Tewksbury, MA
    • Posts 494
    • Points 5,605
    • Avid Developer Moderator
      Avid Employee

    Re: Tutorial: Calling Into Interplay Production WS from .NET Clients

    Don,

    I was able to get this working with the following setup:

    1. Launch Visual Studio (I'm using VS2010)

    2. Create a new Project: Visual Basic, Console Application, call it VSBasicTest

    3. Right Click on Project in the Solution Explorer, and Choose Add Service Reference

    4. Paste in the Infrastructure URL i.e. http://<servername>/services/Assets?wsdl

    5. Use the Namespace InterplayAssets, click OK

    And using the following code:

    Imports VSBasicTest.InterplayAssets

    Module Module1

        Sub Main()

            Console.WriteLine("Interplay WS Test")

            Dim port As New InfrastructurePortTypeClient

            Dim creds As New UserCredentialsType()

            creds.Username = "username"

            creds.Password = "password"

            Dim getVersion As New GetVersionInformationType

            getVersion.WorkgroupURI = "interplay://WGC"

            Dim response As GetVersionInformationResponseType = port.GetVersionInformation(creds, getVersion)

            Dim sInfo As String = response.InterplayWebServicesVersion.ToString()

            Console.WriteLine(sInfo)

        End Sub

    End Module

    Results:

      Interplay WS Test

      3.0.5.0

     

    Hope this helps,

    - Rob

     

Page 1 of 1 (3 items)

© Copyright 2011 Avid Technology, Inc.  Terms of Use |  Privacy Policy |  Site Map |  Find a Reseller