2

I would like to get the Business Process Types in an Alchemy Controller. I have the Alchemy version 0.82 VSIX and also Alchemy Core. When creating a new StarterProject version 7.1 of the CoreService is referenced. I remove it and reference the Web 8 CoreService Client DLL, and then use the below code for getting the Business Process Type. However, I get the following failure. Any ideas?

I see that the Web 8 Endpoint is not in the Core Service Client code here:https://github.com/Alchemy4Tridion/Alchemy4Tridion/blob/master/Alchemy4Tridion.Plugins/Clients/AlchemySessionAwareCoreServiceClient.cs

I updated it with the name of the Web 8 endpoint, but no luck.

The Controller works fine on Web 8 when using Tridion 2013 methods, but not when using a Web 8-only method, such as getting a Business Process Type. I'm working on a plugin that publishes, and I want to get a list of places to publish, which in Web 8 is the 'Purpose' of a BPT Target. Sample code for that is below.

Error:

System.NotSupportedException: Method Read is not supported on this proxy, this can happen if the method is not marked with OperationContractAttribute or if the interface type is not marked with ServiceContractAttribute.

Server stack trace: at System.ServiceModel.Channels.ServiceChannelProxy.GetMethodData(IMethodCallMessage methodCall) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService.Read(String id, ReadOptions readOptions) at AlchemyBatchPublisher.Controllers.PluginController.GetPublishTargets(String publicationUri)

Code:

[HttpGet]
[Route("GetPublishTargets/{uri}")]
public List<PublishTarget> GetPublishTargets(string publicationUri = "")
{
    if (!publicationUri.Contains("tcm"))
    {
        publicationUri = "tcm:" + publicationUri;
    }

    // Caching
    //if (pubTargets.ContainsKey(publicationUri))
    //    return pubTargets[publicationUri];

    List<PublishTarget> localPublishTargets = new List<PublishTarget>();
    PublicationData pd = Client.Read(publicationUri, new ReadOptions()) as PublicationData;
    var bptId = pd.BusinessProcessType.IdRef;
    var bpt = Client.Read(bptId, new ReadOptions()) as BusinessProcessTypeData;
    foreach (var targetType in bpt.TargetTypes)
    {
        PublishTarget pubTargetObj = new PublishTarget()
        {
            Name = targetType.Title,
            URI = targetType.Id,
            Purpose = targetType.Purpose
        };
        localPublishTargets.Add(pubTargetObj);
    }

    return localPublishTargets; 
}

public class PublishTarget
{
    private string _pubUri;
    public string PublicationUri
    {
        get
        {
            return _pubUri;
        }

        set
        {
            if (!value.Contains("tcm:"))
            {
                _pubUri = String.Format("tcm:0-{0}-1", value);
            }
        }
    }

    public string URI { get; set; }
    public string Name { get; set; }
    public string Purpose { get; set; }
}
  • Did you match the properties options while replacing the dll? – Saurabh Gangwar Aug 29 '16 at 10:47
  • Do you mean of the referenced DLL? Only the 'specific version' property of the reference was not the same, and I changed it but with no luck. Any other properties to check? – robrtc Aug 29 '16 at 10:54
  • I see an endpoint config in the source, wonder if this needs to be updated to add the Web 8 one? github.com/Alchemy4Tridion/Alchemy4Tridion/blob/master/… – robrtc Aug 29 '16 at 10:59
  • Yeah, That's what I mean. and yeah may endpoint config needs an update, I didn't use core service with web 8 so not sure. – Saurabh Gangwar Aug 29 '16 at 11:17
  • I added a new endpoint for Web 8 in the sourcecode here and compiled. But how do I install this version as Alchemy? github.com/Alchemy4Tridion/Alchemy4Tridion/blob/master/… – robrtc Aug 29 '16 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.