Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog


Channel Description:

orchardsyndication Issue Tracker Rss Description
    0 0

    I am using VS 2015 running orchard 1.9.2. I have installed the OData module 1.9.0.1 and things work as expected. When I open up the solution and add the Orchard.OData project to the solution, I get a build error.

    This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\Orchard-1.9.2\src\\.nuget\NuGet.targets.

    C:\Orchard-1.9.2\src\Orchard.Web\Modules\Orchard.OData\Orchard.OData.csproj 192

    Pointing to this in the project file. When I comment it out, it builds and runs fine. Should this be removed from the .csproj?


    <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
    </Target>

    0 0

    When adding a service reference as explained here - https://www.cloudconstruct.com/blog/exposing-your-orchard-cms-content-to-your-other-company-applications-and-websites-via-odata
    ...I get 'Value cannot be null
    Parameter name: element' error ' in ProcessRequest, shellroute.cs.
    Version is Orchard-1.9.2
    Tried with local IIS and VS server

    Can we have some docs with query and access scenarios in external projects please.
    I think this module need fleshing out a bit more.

    Thanks

    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.
    Comments: ** Comment from web user: nate_bunton **

    I'm running into the same issue. I'm on Visual Studio 2015, Orchard 1.9.2 and Orchard.OData 1.9.0.1

    Any update on this?

    ```
    The HTML document does not contain Web service discovery information.
    Metadata contains a reference that cannot be resolved: 'http://localhost:30321/odata'.
    The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not
    ```


    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.
    Comments: ** Comment from web user: nate_bunton **

    I dug into this a little deeper. The Orchard.OData module 1.9.x was updated and now implements the OData V4 specs. The 1.0.x and 1.1.x were using earlier specifications of OData. To create a client proxy for OData V4, take a look at this stackoverflow article.

    http://stackoverflow.com/questions/26148775/how-to-add-reference-for-odata-v4-endpoint-using-asp-net-web-api-2-2-to-mvc-clie

    The solution points you to the [OData V4 Client Code Generator](https://visualstudiogallery.msdn.microsoft.com/9b786c0e-79d1-4a50-89a5-125e57475937). I was able to create client proxy objects, however I have not completed the implementation.

    OSTEPHAN, would you be able to provide some code snippets on how to consume data using OData V4?


    0 0

    When adding a service reference as explained here - https://www.cloudconstruct.com/blog/exposing-your-orchard-cms-content-to-your-other-company-applications-and-websites-via-odata
    ...I get 'Value cannot be null
    Parameter name: element' error ' in ProcessRequest, shellroute.cs.
    Version is Orchard-1.9.2
    Tried with local IIS and VS server

    Can we have some docs with query and access scenarios in external projects please.
    I think this module need fleshing out a bit more.

    Thanks
    Comments: ** Comment from web user: nate_bunton **

    The article on cloudconstruct.com was written for previous versions. It works beautifully for Orchard 1.8.x and Orchard.OData module 1.0.x and 1.1.x. I believe the latest versions of the OData module use newer OData V4 specifications.

    See Issue #2306 - Adding service reference in Visual Studio fails.


    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.
    Comments: ** Comment from web user: arock3 **

    I ended up using the T4 templates in Visual Studio to generate the proxy classes needed. This worked, but it seems to fail when connecting to the site subsequent times for some reason when I pull data.

    http://blogs.msdn.com/b/odatateam/archive/2014/03/12/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx

    My thought for now is too pull the data once on application start and then cache the data for subsequent requests. Something must be staying open.

    -Arra (CloudConstruct)


    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.
    Comments: ** Comment from web user: nate_bunton **

    I did a little more debugging. I do not have a solution, but here is what I have come across.

    My client code after generating the proxy objects from the T4 templates:

    ```
    var localOData = new LocalCms.DefaultContainer(new Uri("http://localhost.fiddler:30329/odata"));
    var persons = localOData.Persons.ToList();
    ```
    Here is the inner exception message:

    ```
    The response payload is a not a valid response payload. Please make sure that the top level element is a valid Atom or JSON element or belongs to 'http://docs.oasis-open.org/odata/ns/data' namespace.
    ```

    I ran it through fiddler and here is what fiddler sees:

    Raw Request:
    ```
    GET http://localhost:30329/odata/Persons HTTP/1.1
    OData-Version: 4.0
    OData-MaxVersion: 4.0
    Accept: application/json;odata.metadata=minimal
    Accept-Charset: UTF-8
    User-Agent: Microsoft ADO.NET Data Services
    Host: localhost:30329
    Connection: Keep-Alive

    ```

    Raw Response:
    ```
    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: text/html
    Server: Microsoft-IIS/10.0
    X-Generator: Orchard
    OData-Version: 4.0
    X-AspNet-Version: 4.0.30319
    X-SourceFiles: =?UTF-8?B?QzpcTlJCXENvZGVcT3JjaGFyZC0xLjkuMlxzcmNcT3JjaGFyZC5XZWJcb2RhdGFcUGVyc29ucw==?=
    X-Powered-By: ASP.NET
    Date: Wed, 18 Nov 2015 18:59:56 GMT
    Content-Length: 593

    {"@odata.context":"http://localhost:30329/odata/$metadata#Persons","value":[{"Id":12,"CommonPart":{"CreatedUtc":"2015-11-18T12:46:55.7318-06:00","PublishedUtc":"2015-11-18T12:46:55.9588-06:00","ModifiedUtc":"2015-11-18T12:46:55.9478-06:00","VersionCreatedUtc":"2015-11-18T12:46:55-06:00","VersionPublishedUtc":"2015-11-18T12:46:55-06:00","VersionModifiedUtc":"2015-11-18T12:46:55-06:00","Id":12},"TitlePart":{"Title":"Nate Bunton","Id":12},"Name":{"Value":"Nate Bunton","Name":"Name","DisplayName":"Name"},"JobTitle":{"Value":"Software Engineer","Name":"JobTitle","DisplayName":"Job Title"}}]}
    ```

    It appears that the web request processes successfully, but when parsing the web request ODat gets choked up. I'm not sure if it is on the client proxy end or the OData response from the Orchard OData module is not proper format. I will continue investigating.


    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.
    Comments: ** Comment from web user: nate_bunton **

    I got to the bottom of this. This is related to issue #2300. On 7/15/15, OStephan said he will merge this into the next release. I'm not sure what OStephan's plan is with this bug fix.

    So for now, you can do this...

    In ODataHttpHandler.cs in this method...

    ```
    void IHttpHandler.ProcessRequest(HttpContext context) {
    ```

    Around line 62, add this finally block
    ```
    finally {
    // ##### CONTENT-TYPE BUG FIX BY NETHERWIND
    if (!string.IsNullOrEmpty(httpResponse.Headers[ODataConstants.ContentTypeHeader])) {
    httpResponse.ContentType = httpResponse.Headers[ODataConstants.ContentTypeHeader];
    }
    }
    ```


    0 0

    I am using VS 2015 running orchard 1.9.2. I have installed the OData module 1.9.0.1 and things work as expected. When I open up the solution and add the Orchard.OData project to the solution, I get a build error.

    ```
    This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\Orchard-1.9.2\src\\.nuget\NuGet.targets.

    C:\Orchard-1.9.2\src\Orchard.Web\Modules\Orchard.OData\Orchard.OData.csproj 192
    ```

    Pointing to this in the project file. When I comment it out, it builds and runs fine. Should this be removed from the .csproj?

    ```
    <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
    </Target>
    ```

    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.
    Comments: ** Comment from web user: OSTEPHAN **

    [Refers to issue 2300](https://orchardsyndication.codeplex.com/workitem/2300)


    0 0

    OSTEPHAN, I am trying to add a service reference in visual studio 2012 and getting a failure.

    The document at the url https://mysite.com/odata was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
    - Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
    - Data at the root level is invalid. Line 1, position 1.
    Metadata contains a reference that cannot be resolved: 'https://mysite.com/odata'.
    The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 175 bytes of the response were: '{"error":{"code":"NotImplemented","message":"","innererror":{"message":"The method or operation is not implemented.","type":"System.NotImplementedException","stacktrace":""}}}'.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    It looks like the content type is not correct. I am in Orchard 1.9. I tried the hotfix.zip from the other user and that did not seem to help.

    0 0

    When adding a service reference as explained here - https://www.cloudconstruct.com/blog/exposing-your-orchard-cms-content-to-your-other-company-applications-and-websites-via-odata
    ...I get 'Value cannot be null
    Parameter name: element' error ' in ProcessRequest, shellroute.cs.
    Version is Orchard-1.9.2
    Tried with local IIS and VS server

    Can we have some docs with query and access scenarios in external projects please.
    I think this module need fleshing out a bit more.

    Thanks
    Comments: ** Comment from web user: OSTEPHAN **

    [Refers to issue 2300](https://orchardsyndication.codeplex.com/workitem/2300)


    0 0

    When adding a service reference as explained here - https://www.cloudconstruct.com/blog/exposing-your-orchard-cms-content-to-your-other-company-applications-and-websites-via-odata
    ...I get 'Value cannot be null
    Parameter name: element' error ' in ProcessRequest, shellroute.cs.
    Version is Orchard-1.9.2
    Tried with local IIS and VS server

    Can we have some docs with query and access scenarios in external projects please.
    I think this module need fleshing out a bit more.

    Thanks

    0 0

    When adding a service reference as explained here - https://www.cloudconstruct.com/blog/exposing-your-orchard-cms-content-to-your-other-company-applications-and-websites-via-odata
    ...I get 'Value cannot be null
    Parameter name: element' error ' in ProcessRequest, shellroute.cs.
    Version is Orchard-1.9.2
    Tried with local IIS and VS server

    Can we have some docs with query and access scenarios in external projects please.
    I think this module need fleshing out a bit more.

    Thanks

    0 0

    When adding a service reference as explained here - https://www.cloudconstruct.com/blog/exposing-your-orchard-cms-content-to-your-other-company-applications-and-websites-via-odata
    ...I get 'Value cannot be null
    Parameter name: element' error ' in ProcessRequest, shellroute.cs.
    Version is Orchard-1.9.2
    Tried with local IIS and VS server

    Can we have some docs with query and access scenarios in external projects please.
    I think this module need fleshing out a bit more.

    Thanks

    0 0

    I'm having issues with the value of a taxonomy field being returned in the OData response.


    * I created a new Taxonomy with a few terms.
    * I created a new Content Definition with 2 Text Fields and 1 Taxonomy Field.
    * I used the OData v4 Client Code generator
    * I used the hotfix from issue #2300

    Below is my sample app calling the OData api and the response. You can see that the "Category" field does not have a Value.

    ```
    var localOData = new DefaultContainer(new Uri("http://localhost:30329/odata"));
    var faqs = localOData.FAQs.ToList();

    foreach (var faq in faqs)
    {
    Console.WriteLine(string.Format("Category: {0} \n\rQuestion: {1} \r\nAnswer: {2}\r\n\r\n", faq.Category.DisplayName, faq.Question.Value, faq.Answer.Value));
    }
    ```
    {
    "@odata.context": "http://localhost:30329/odata/$metadata#FAQs",
    "value": [
    {
    "Id": 16,
    "CommonPart": {
    "CreatedUtc": "2015-12-08T21:12:19.097-06:00",
    "PublishedUtc": "2015-12-08T21:12:19.22-06:00",
    "ModifiedUtc": "2015-12-08T21:12:19.211-06:00",
    "VersionCreatedUtc": "2015-12-08T21:12:19-06:00",
    "VersionPublishedUtc": "2015-12-08T21:12:19-06:00",
    "VersionModifiedUtc": "2015-12-08T21:12:19-06:00",
    "Id": 16
    },
    "TitlePart": {
    "Title": "Card usage - 1",
    "Id": 16
    },
    "Question": {
    "Value": "How do I use my card?",
    "Name": "Question",
    "DisplayName": "Question"
    },
    "Answer": {
    "Value": "<p>It's easy.</p>\n<ol>\n<li>Get out your card</li>\n<li>Swipe your card</li>\n<li>Sign th receipt</li>\n</ol>\n<p>That's it!</p>",
    "Name": "Answer",
    "DisplayName": "Answer"
    },
    "Category": {
    "Name": "Category",
    "DisplayName": "Category"
    }
    },
    {
    "Id": 17,
    "CommonPart": {
    "CreatedUtc": "2015-12-08T21:13:19.529-06:00",
    "PublishedUtc": "2015-12-08T21:13:19.612-06:00",
    "ModifiedUtc": "2015-12-08T21:13:19.605-06:00",
    "VersionCreatedUtc": "2015-12-08T21:13:19-06:00",
    "VersionPublishedUtc": "2015-12-08T21:13:19-06:00",
    "VersionModifiedUtc": "2015-12-08T21:13:19-06:00",
    "Id": 17
    },
    "TitlePart": {
    "Title": "Card usage - 2",
    "Id": 17
    },
    "Question": {
    "Value": "Can I use my card at the pump?",
    "Name": "Question",
    "DisplayName": "Question"
    },
    "Answer": {
    "Value": "<p>Make sure you pay inside and select credit.</p>",
    "Name": "Answer",
    "DisplayName": "Answer"
    },
    "Category": {
    "Name": "Category",
    "DisplayName": "Category"
    }
    }
    ]
    }
    ```

    ```

    0 0

    Hi Team,

    We have multiple odata call in one page (Async call- using JS in front end)
    http://xxxx.xxx.xxx/odata/Learning(10)
    http://xxxx.xxx.xxx/odata/Learning1(10)
    http://xxxx.xxx.xxx/odata/Learning2(10)
    http://xxxx.xxx.xxx/odata/Learning3(10)

    **we are using Orchard 1.9.2 and Orchard.OData from Gallery".

    we are getting below issues. Please guide us to fix this issue.

    Error Details:
    2016-03-17 00:09:03,064 [10] NHibernate.Util.ADOExceptionReporter - (null) - There was a problem converting an IDataReader to NDataReader
    (null)
    2016-03-17 00:09:03,103 [11] NHibernate.Util.ADOExceptionReporter - (null) - While preparing SELECT commonpart0_.Id as Id74_0_, commonpart0_.CreatedUtc as CreatedUtc74_0_, commonpart0_.PublishedUtc as Publishe3_74_0_, commonpart0_.ModifiedUtc as Modified4_74_0_, commonpart0_.ContentItemRecord_id as ContentI5_74_0_ FROM Common_CommonPartVersionRecord commonpart0_ WHERE commonpart0_.Id=@p0 an error occurred
    (null)
    2016-03-17 00:09:03,115 [11] NHibernate.Util.ADOExceptionReporter - (null) - Prepare requires an open and available Connection. The connection's current state is closed.
    (null)
    2016-03-17 00:09:03,114 [10] NHibernate.Util.ADOExceptionReporter - (null) - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    (null)
    2016-03-17 00:09:03,116 [10] NHibernate.Util.ADOExceptionReporter - (null) - The wait operation timed out

    0 0

    Hi, OSTEPHAN:


    I installed the Orchard 1.9.1 and Orchard.Syndication.OData-1.9.0.1 on my computer with VS2013+WIN 7, Then I write some client's test code using "OData V4 Client Code Genterator", it will got an error that told "Please make sure that the top level element is a valid Atom or JSON element"

    I tried many time that I found it always returned "content-type:text/html" at all odata request, so I checked the your code and I found something error at "Orchard.OData.ODataExtensions.GetODataMessageWriter"

    ```
    internal static ODataMessageWriter GetODataMessageWriter(this HttpContext httpContext,
    HttpStatusCode statusCode, string contentTypeHeader, IEdmModel edmModel) {
    var httpRequest = httpContext.Request;
    var httpResponse = httpContext.Response;

    // #### problem line ####
    httpResponse.Headers.Add(ODataConstants.ContentTypeHeader, contentTypeHeader);

    var httpWebResponseMessage = new HttpWebResponseMessage(
    httpResponse.Headers.ToDictionary(),
    (int)statusCode,
    () => httpResponse.OutputStream) as IODataResponseMessage;

    var settings = new ODataMessageWriterSettings();
    //settings.SetContentType(ODataFormat.Json);
    settings.ODataUri = new ODataUri() { ServiceRoot = httpRequest.ODataRootService() };

    return new ODataMessageWriter((IODataResponseMessage)httpWebResponseMessage, settings, edmModel);
    }
    ```

    I've reading the code of "HttpResponse.cs", and I found httpResponse.ContentType will set to httpResposne.Header["Content-type"] when response flushing, so it don't work in .NET 4.X with IISExpress OR IIS, maybe it work in Azure?

    but If I direct set httpResponse.ContentType , it will get another OData error, so I add some code at Orchard.OData.Services.ODataHttpHandler

    ```
    void IHttpHandler.ProcessRequest(HttpContext context) {
    var oDataHttpHandler = this as IODataHttpHandler;
    var edmModel = this._metadataBuilder.BuildModel();

    var httpRequest = context.Request;
    var httpResponse = context.Response;

    httpResponse.Headers.Add(ODataConstants.ODataVersionHeader, ODataHttpHandler.odata_version);
    var lastUriSegment = httpRequest.Url.Segments.LastOrDefault();

    try {
    if (httpRequest.HttpMethod.ToLower() != "get") {
    throw new ODataErrorException(new ODataError() {
    ErrorCode = HttpStatusCode.NotImplemented.ToString(),
    InnerError = new ODataInnerError(new NotImplementedException()) });
    }
    if (lastUriSegment.ToLower().StartsWith("odata")) {
    oDataHttpHandler.ProcessServiceDocumentRequest(context, edmModel);
    return;
    }
    if (lastUriSegment.ToLower() == "$metadata") {
    oDataHttpHandler.ProcessMetadataRequest(context, edmModel);
    return;
    }
    oDataHttpHandler.ProcessDataRequest(context, edmModel);

    }
    catch (ODataErrorException oDataException) {
    HttpStatusCode httpStatusCode = HttpStatusCode.BadRequest;
    Enum.TryParse<HttpStatusCode>(oDataException.Error.ErrorCode, out httpStatusCode);
    var odataWriter = context.GetODataMessageWriter(httpStatusCode, MimeConstants.MimeApplicationJson, edmModel);
    odataWriter.WriteError(oDataException.Error, true);
    }
    catch {
    throw;
    }
    finally
    {
    // ##### CONTENT-TYPE BUG FIX BY NETHERWIND
    if( !string.IsNullOrEmpty( context.Response.Headers["content-type"] ) )
    {
    context.Response.ContentType = context.Response.Headers["content-type"];
    }
    }
    }
    ```

    Then my client application worked. may be here have compatibility bug?


    Another error that it always display error when no query data matched, but custom odata webapi base on ODataController will not, so I changed some code at "IODataHttpHandler.ProcessDataRequest"
    ```
    void IODataHttpHandler.ProcessDataRequest(HttpContext context, IEdmModel edmModel) {

    // ####### begin fix [by NetherWind]
    var requestUri = context.Request.Url;
    var lastSegment = requestUri.Segments.Last();

    var entitySetName = lastSegment.Split("(".ToArray()).First();
    var entitySet = edmModel.FindEntityContainer(MetadataBuilder._qualifiedContainer)
    .EntitySets()
    .FirstOrDefault(es => es.Name.ToLower() == entitySetName.ToLower());

    if (null == entitySet)
    {
    throw new ODataErrorException(new ODataError()
    {
    ErrorCode = HttpStatusCode.NotFound.ToString()
    });
    }

    var entityType = entitySet.EntityType();



    var contentItems = this._dataRequestBroker.ExecuteQuery(context.Request, edmModel);

    //if (!(null != contentItems && contentItems.Any()))
    if ( null == contentItems )
    {
    throw new ODataErrorException(new ODataError() {
    ErrorCode = HttpStatusCode.NoContent.ToString() });
    }
    // ####### end fix [by NetherWind]

    var contentItemEntries = contentItems
    .Select(contentItem => this._dataRequestBroker.BuildEntry(contentItem, edmModel))
    .ToList();

    // var entitySetName = contentItems.First().TypeDefinition.Name + "s";
    // var entitySet = edmModel.EntityContainer.EntitySets().First(es => es.Name == entitySetName);
    // var entityType = entitySet.EntityType();

    var odataWriter = context.GetODataMessageWriter(HttpStatusCode.OK, MimeConstants.MimeApplicationJson, edmModel);
    ODataWriter feedWriter = odataWriter.CreateODataFeedWriter(entitySet, entityType);
    feedWriter.WriteStart(new ODataFeed() {
    Id = new System.Uri(context.Request.ODataRootService(), entitySet.Name)
    });
    contentItemEntries.ForEach(cie => {
    feedWriter.WriteStart(cie);
    feedWriter.WriteEnd();
    });
    feedWriter.WriteEnd();
    }
    ```
    it only just worked but it broked OO struction, I don't have more solution so I using this bad hot fix because I am Orchard's greenhand, Could you help me test my code and fix bug?
    Comments: ** Comment from web user: nate_bunton **

    OStephan do you have an expected release of the bug fix?


    0 0

    I'm having issues with the value of a taxonomy field being returned in the OData response.


    * I created a new Taxonomy with a few terms.
    * I created a new Content Definition with 2 Text Fields and 1 Taxonomy Field.
    * I used the OData v4 Client Code generator
    * I used the hotfix from issue #2300

    Below is my sample app calling the OData api and the response. You can see that the "Category" field does not have a Value.

    ```
    var localOData = new DefaultContainer(new Uri("http://localhost:30329/odata"));
    var faqs = localOData.FAQs.ToList();

    foreach (var faq in faqs)
    {
    Console.WriteLine(string.Format("Category: {0} \n\rQuestion: {1} \r\nAnswer: {2}\r\n\r\n", faq.Category.DisplayName, faq.Question.Value, faq.Answer.Value));
    }
    ```
    {
    "@odata.context": "http://localhost:30329/odata/$metadata#FAQs",
    "value": [
    {
    "Id": 16,
    "CommonPart": {
    "CreatedUtc": "2015-12-08T21:12:19.097-06:00",
    "PublishedUtc": "2015-12-08T21:12:19.22-06:00",
    "ModifiedUtc": "2015-12-08T21:12:19.211-06:00",
    "VersionCreatedUtc": "2015-12-08T21:12:19-06:00",
    "VersionPublishedUtc": "2015-12-08T21:12:19-06:00",
    "VersionModifiedUtc": "2015-12-08T21:12:19-06:00",
    "Id": 16
    },
    "TitlePart": {
    "Title": "Card usage - 1",
    "Id": 16
    },
    "Question": {
    "Value": "How do I use my card?",
    "Name": "Question",
    "DisplayName": "Question"
    },
    "Answer": {
    "Value": "<p>It's easy.</p>\n<ol>\n<li>Get out your card</li>\n<li>Swipe your card</li>\n<li>Sign th receipt</li>\n</ol>\n<p>That's it!</p>",
    "Name": "Answer",
    "DisplayName": "Answer"
    },
    "Category": {
    "Name": "Category",
    "DisplayName": "Category"
    }
    },
    {
    "Id": 17,
    "CommonPart": {
    "CreatedUtc": "2015-12-08T21:13:19.529-06:00",
    "PublishedUtc": "2015-12-08T21:13:19.612-06:00",
    "ModifiedUtc": "2015-12-08T21:13:19.605-06:00",
    "VersionCreatedUtc": "2015-12-08T21:13:19-06:00",
    "VersionPublishedUtc": "2015-12-08T21:13:19-06:00",
    "VersionModifiedUtc": "2015-12-08T21:13:19-06:00",
    "Id": 17
    },
    "TitlePart": {
    "Title": "Card usage - 2",
    "Id": 17
    },
    "Question": {
    "Value": "Can I use my card at the pump?",
    "Name": "Question",
    "DisplayName": "Question"
    },
    "Answer": {
    "Value": "<p>Make sure you pay inside and select credit.</p>",
    "Name": "Answer",
    "DisplayName": "Answer"
    },
    "Category": {
    "Name": "Category",
    "DisplayName": "Category"
    }
    }
    ]
    }
    ```

    ```
    Comments: ** Comment from web user: nate_bunton **

    OStephan is it possible for taxonomies to be returned in the API? I have stepped through the code and I can't identify a bug fix? I'd like to update to the latest version but our existing data is using taxonomies.


    0 0

    I installed OrchardCMS 1.10 from the .zip file
    https://github.com/OrchardCMS/Orchard/releases/download/1.10/Orchard.Web.zip
    And am testing in WebMatrix 3.

    I installed OData module from the gallery: "Orchard.OData - Version: 1.9.0.1", and I added to web.config <system.serviceModel> as per the instructions in this home page.

    When I go to /odata/$metadata, I get message:
    Not found
    The page you are looking for does not exist.

    Is the OData 1.9 compatible with Orchard 1.10?
    Any other thoughts?