I'm trying to install the odata service in .NET.
Our Tridion Content Manager and frontend are working fine as well as the Deployer.
I found the oData folder in our Tridion Installers, with this structure
/dll
/X86
/X86_64
/bin (I put dlls here)
/bin/config (I put conf files here)
/bin/lib (I put jars here)
access_token.svc
Global.asax
linking.svc
odata.svc
Web.config
web.xml
UPDATE #1
I found the instructions in the Tridion 2011 manual and followed every step, I copied the required JAR files and conf files sw well as the license XML file. I also created the IIS app.
When I navigate to the url http://domain/odata/odata.svc I get a blank page, no XML output and no NET errors.
If I create a new AppPool I get this error com.tridion.webservices.odata.input.handler.ODataWebserviceHandler
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Java.Lang.ClassNotFoundException: com.tridion.webservices.odata.input.handler.ODataWebserviceHandler
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ClassNotFoundException: com.tridion.webservices.odata.input.handler.ODataWebserviceHandler]
Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +579
Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1471
Codemesh.JuggerNET.JavaClass.init() +348
Codemesh.JuggerNET.JavaClass.get_JObject() +46
Codemesh.JuggerNET.JavaField.init() +1081
Codemesh.JuggerNET.JavaField.get_FieldPtr() +58
Codemesh.JuggerNET.JavaField.get_staticobjectValue() +113
Com.Tridion.Webservices.Odata.Input.Handler.ODataWebserviceHandler.get_ODATA_SERVICE() +25
UPDATE #2
Now I get this page, telling me that the metadata is not activated and that I should implement this in the web.config but when I do, it keeps showing the same page.
<services>
<!-- Note: the service name must match the configuration name for the service implementation. -->
<service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" >
<!-- Add the following endpoint. -->
<!-- Note: your service must have an http base address to add this endpoint. -->
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<!-- Add the following element to your service behavior configuration. -->
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
I tried to replace the name MyNamespace.MyServiceType with the one defined in the odata.svc file which is Tridion.ContentDelivery.WebService.OdataService but this one is already defined like this:
<service name="Tridion.ContentDelivery.Webservice.ODataService">
<endpoint behaviorConfiguration="webHttp" binding="webHttpBinding" contract="Tridion.ContentDelivery.Webservice.IODataService" />
</service>
UPDATE # 3
I think I don't have to setup the Metadata for Odata. I tried different ways to install the behavior and the endpoint with the IMetadataExchange to no avail.
These are the errors I get in the oData log file:
2016-08-23 08:49:26,590 ERROR JPQLExecutor - Can not create JPAQueryDAO object
com.tridion.broker.StorageException: No Data Access Object Factory for BrokerDB. Check if the default file system is properly defined and ItemTypes defaultStorageId is correct.
at com.tridion.storage.StorageManagerFactory.getDAOFactoryForStorageId(StorageManagerFactory.java:607) ~[cd_datalayer.jar:na]
at com.tridion.storage.StorageManagerFactory.getOriginalDAO(StorageManagerFactory.java:445) ~[cd_datalayer.jar:na]
at com.tridion.storage.StorageManagerFactory.getDAO(StorageManagerFactory.java:271) ~[cd_datalayer.jar:na]
at com.tridion.storage.StorageManagerFactory.getDefaultDAO(StorageManagerFactory.java:178) ~[cd_datalayer.jar:na]
at com.tridion.webservices.odata.input.jpql.JPQLExecutor.<init>(JPQLExecutor.java:61) [cd_webservice.jar:na]
at com.tridion.webservices.odata.input.jpql.JPQLExecutor.getExecutor(JPQLExecutor.java:103) [cd_webservice.jar:na]
at com.tridion.webservices.odata.input.resolver.PublicationsResolver.resolveCollection(PublicationsResolver.java:34) [cd_webservice.jar:na]
at com.tridion.webservices.odata.input.resolver.ResolverBase.resolve(ResolverBase.java:74) [cd_webservice.jar:na]
at com.tridion.webservices.odata.input.handler.ODataFeedRenderer.renderODataFeed(ODataFeedRenderer.java:45) [cd_webservice.jar:na]
at com.tridion.webservices.odata.input.handler.ODataWebserviceHandler.handleODataEntity(ODataWebserviceHandler.java:193) [cd_webservice.jar:na]
at com.tridion.webservices.odata.input.handler.ODataWebserviceHandler.handleResourceRequest(ODataWebserviceHandler.java:169) [cd_webservice.jar:na]
2016-08-23 08:49:26,590 ERROR JPQLExecutor - JPAQueryDAO has not been instantiated. Probably FS storage type was used.
2016-08-23 08:52:03,588 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2016-08-23 08:53:25,267 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2016-08-23 08:53:51,841 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2016-08-23 08:54:19,846 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2016-08-23 08:54:26,594 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
and in the front page I get
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /odata/odata.svc
Or sometimes I get
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
I double checked the config files, the Broker user and password (which are the same settings of my Tridion Content Manager) and the Application pool running only 64 Bits and still can't get it to work.
I will update an answer as soon as I get it working.
UPDATE #5
After different modifications in the web.config I get this error when I add an entry of my localhost to :
Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [net.tcp].
Or this one when without the entry in the :
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
UPDATE #5
I decided to start over, double checking every step and got to the page where IIS says that the metadata is not activated.
I did not activated it in the Web.config but in the cd_storage_conf.xml in the ItemTypes tage like this:
<Item typeMapping="Metadata" storageId="BrokerDB" cached="false"/>
I also noticed that my URL http://domain:8080/odata/odata.svc was always showing the IIS error page telling me to activate the metadata, but when I (by accident) call the same URL with a final forward slash (http://domain:8080/odata/odata.svc) the page load the correct metadata fields from the Broker database (Pages, Publications, components, etc).
Now the oData is working fine.