Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consuming the Tridion 2011 linking.svc service in ASP.NET

Tags:

tridion

I receive the following error when attempting to add a service reference to /linking.svc in my ASP.NET application:

There was an error downloading http://localhost:82/linking.svc/. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: http://localhost:82/linking.svc/. There was no endpoint listening at http://localhost:82/linking.svc/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found. If the service is defined in the current solution, try building the solution and adding the service reference again.

I thought I could consume the linking service in the same way as odata (add service reference in Visual Studio) as odata works fine for me. I've checked the web.config of my services installation and both endpoints look correctly configured.

<!-- HTTP support -->
        <service name="Tridion.ContentDelivery.Webservice.ODataService">
            <endpoint behaviorConfiguration="webHttp" bindingConfiguration="HttpBinding" binding="webHttpBinding" contract="Tridion.ContentDelivery.Webservice.IODataService" />
        </service>
        <service name="Tridion.ContentDelivery.Webservice.LinkingService">
            <endpoint behaviorConfiguration="webHttp" bindingConfiguration="HttpBinding" binding="webHttpBinding" contract="Tridion.ContentDelivery.Webservice.Ilinking" />
        </service>
        <service name="Tridi

I assume i'm attempting to consume the linking.svc in an incorrect way.

My question... Am I following the correct procedure for using the linking.svc service in a Visual Studio ASP.NET project? If not, please could you help me to understand how to utilise this api.

Many thanks

like image 813
Jonathan Primmer Avatar asked Sep 05 '12 17:09

Jonathan Primmer


1 Answers

Did you consider writing your own client for the linking service? It is a quite simple REST-ful web service, so you can access it with a standard WebClient:

From an example by Mihai Cadariu:

WebClient client = new WebClient();
string linkingServiceUrl = "http://tridion.server:8080/services/linking.svc";
string COMPONENT_LINK = "/componentLink?sourcePageURI={0}&targetComponentURI={1}&excludeTemplateURI={2}&linkTagAttributes={3}&linkText={4}&showTextOnFail={5}&showAnchor={6}";
string url = linkingServiceUrl +
    string.Format(COMPONENT_LINK,
    sourcePageUri,
    targetComponentUri,
    excludeTemplateUri,
    HttpUtility.UrlEncode(linkTagAttributes),
    HttpUtility.UrlEncode(linkText),
    showTextOnFail,
    showAnchor);
return client.DownloadString(url);
like image 162
Frank van Puffelen Avatar answered Sep 19 '22 10:09

Frank van Puffelen