Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Error deserializing Activity objects on Retrieve() call #101

Open
rodelpontanares opened this issue Sep 24, 2021 · 1 comment
Open

Error deserializing Activity objects on Retrieve() call #101

rodelpontanares opened this issue Sep 24, 2021 · 1 comment

Comments

@rodelpontanares
Copy link

Here is a sample code that illustrates the issue for me (I did remove the connection info from the sample code).

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.ServiceModel;

using BarokziWorks;

using FuelSDK;

namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new ETClient(new NameValueCollection
            {
                { "clientId", "***" },
                { "clientSecret", "***" },
                { "accountId", "***" },
                { "authEndPoint", "***" },
                { "restEndPoint", "***" },
                { "soapEndPoint", "***" },
                { "useOAuth2Authentication", "true" }
            });

            RetrieveRequest rr = new RetrieveRequest();
            rr.ObjectType = "activity";
            rr.Properties = new[] { "sequence" };


            string status = null;
            List<AutomationActivity> list = new List<AutomationActivity>();

            using (var scope = new OperationContextScope(client.SoapClient.InnerChannel))
            {
                var msgHeader = System.ServiceModel.Channels.MessageHeader.CreateHeader("fueloauth", @"http://tempuri.org", client.AuthToken);
                OperationContext.Current.OutgoingMessageHeaders.Add(msgHeader);

                status = client.SoapClient.Retrieve(rr, out string requestID, out APIObject[] results);

                while (status.In("OK", "MoreResults") && results.Length > 0)
                {
                    list.AddRange(results.Where(r => r.PartnerProperties?[0].Name != "ErrorMessage").Cast<AutomationActivity>());
                    if (status == "MoreResults")
                    {
                        rr.ContinueRequest = requestID;
                        status = client.SoapClient.Retrieve(rr, out requestID, out results);
                    }
                    else
                        break;
                }
            }
        }
    }
}
`
@rodelpontanares
Copy link
Author

In the original post above, it appears the SOAP API recognizes the object type but the SDK probably does not or does not have an Activity type (just a guess).

So, I also tried using "automationactivity" for rr.ObjectType but the in this case it seems the SOAP API does not recognize the type.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant