Trision 2011 CoreService Connection

I am using Tridion 2011 SP1 and connecting to CoreService using the code here:

http://code.google.com/p/tridion-practice/wiki/GetCoreServiceClientWithoutConfigFile

But when I try to perform any simple operation, for example:

XElement resultXml = _coreService.GetListXml(publicationId, filterData); 

I get the following error message.

"{" Message with action "http://www.sdltridion.com/ContentManager/CoreService/2011/ICoreService/Create 'cannot be processed at the receiver due to a ContractFilter mismatch in the EndpointDispatcher. This may be due to a contract mismatch ( mismatch between the sender and the recipient) or a binding / security mismatch between the sender and the recipient. Make sure that the sender and the recipient have the same contract and the same binding (including security requirements, such as message, transport, no). " } "

Any ideas?

Full code here:

  RepositoryItemsFilterData filterData = new RepositoryItemsFilterData(); filterData.ItemTypes = new[] { ItemType.Component, ItemType.Schema }; filterData.Recursive = true; ICoreService _coreService = GetNewClient(); XElement resultXml = _coreService.GetListXml(publicationId, filterData); private ICoreService GetNewClient() { var binding = new BasicHttpBinding() { MaxBufferSize = 4194304, // 4MB MaxBufferPoolSize = 4194304, MaxReceivedMessageSize = 4194304, ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas() { MaxStringContentLength = 4194304, // 4MB MaxArrayLength = 4194304, }, Security = new BasicHttpSecurity() { Mode = BasicHttpSecurityMode.TransportCredentialOnly, Transport = new HttpTransportSecurity() { ClientCredentialType = HttpClientCredentialType.Windows, } } }; _hostname = string.Format("{0}{1}{2}", _hostname.StartsWith("http") ? "" : "http://", _hostname, _hostname.EndsWith("/") ? "" : "/"); var endpoint = new EndpointAddress(_hostname + "webservices/CoreService.svc/basicHttp_2010"); ChannelFactory<ICoreService> factory = new ChannelFactory<ICoreService>(binding, endpoint); factory.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential(_username, _password); return factory.CreateChannel(); } 



UPDATE: Thanks for the answer from Nuno and Frank, I now have a job adding a link to the service, just a little curious why my code didn’t work, because it creates below bindings which, as far as I can see (and I maybe, that- then missed), same code above
Nuno's approach also works - thanks Nuno.

<basicHttpBinding> <binding name="basicHttp_2010"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> </security> </binding> </basicHttpBinding>

+6
source share
4 answers

This is not the answer to your question, but here's how I feel about Core Service clients right now:

  • Add link to [Tridion] \ bin \ client \ Tridion.ContentManager.CoreService.Client.dll
  • Copy the contents of [Tridion] \ bin \ client \ Tridion.ContentManager.CoreService.Client.dll.Config to your own app.config

Then in code, simply do the following:

 SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient("netTcp_2011"); 

Done.

PS - As suggested by Frank, this was added to the Tridion wiki: http://code.google.com/p/tridion-practice/wiki/GetCoreServiceClientWithConfigFile

+5
source

It seems that the bindings you created do not meet the expectations of the server. Look at the .config on your TCM server and make sure that the client side creates the same type of binding.

+3
source

You are connecting to the wrong endpoint. You cannot connect to the 2010 version of the core service using the 2011 client.

Instead, you should connect to endpoint 2011 (... / webservices / CoreService2011.svc / basicHttp)

Of course, you can change your link to the 2010 version of the client, but I would not do this if you had no problems.

+1
source

I fixed the same error by changing / CoreService / 2012 / to / CoreService / 2013 / in my application configuration here:

 <endpoint name="netTcp_2012" address="net.tcp://localhost:2660/CoreService/2013/netTcp" binding="netTcpBinding" bindingConfiguration="netTcp" contract="Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService" /> 

I suspect that I initially created my main service application in Tridion 2011, and then I tried to run it with Tridion 2013.

0
source

Source: https://habr.com/ru/post/925712/


All Articles