locked
Getting OData to work with OpenSearch RRS feed

  • Question

  • Hi,

    I have been trying to get my OData provider to act as a search provider for OpenSearch/Federated Search, by specifying an osdx file.

    The search part is actually working fine, but the result view is quite useless.

    OpenSearch (as implemented in Windows 7 and above) can handle results returned in ATOM and OData can return an ATOM payload, so it should be possible.

    The issue that I am facing is that OpenSearch expects a link element for each item in the payload that does not have a rel attribute (or at least an empty one), but WCF DS OData are returning link elements with rel="edit" or rel="edit-media", so I tried to add this to my entities by the use of an EntityPropertyMappingAttribute in my custom metadata provider, but i can't get the namespaces right.

    According to the documentation of the EntityPropertyMappingAttribute it should be possible to construct one without specifying a namespace and prefix with the result that it get put in the default namespace, but it gives me an exception complaining about the targetNameSpaceUri cannot be null.

    From the documentation at: http://msdn.microsoft.com/en-us/library/ee474301(v=vs.103).aspx it states that:

    "If neither targetNamespacePrefix nor targetNamespaceUri are specified, the targetName will be put in the default namespace".

    So when I do this in my custom metadata provider:

    resourceType.AddEntityPropertyMappingAttribute(new EntityPropertyMappingAttribute("Abc", "link/@href", null, null, false));
    

    I get an exception "The 'targetNamespaceUri' value provided for the EntityPropertyMappingAttribute is not valid."

    If I set the namespace uri to the default ATOM by doing this:

    resourceType.AddEntityPropertyMappingAttribute(new EntityPropertyMappingAttribute("Abc", "link/@href", null, "http://www.w3.org/2005/Atom", false));

    But then the href attribute gets injected the namespace and OpenSearch in Explorer refuses to handle it. The result in my payload looks something like this:

    <link p6:href="http://HOST/Archive/Doc.docx" xmlns:p6="http://www.w3.org/2005/Atom" />

    What I would like to end up with is this:

    <link href="http://HOST/Archive/Doc.docx" />

    How can I accomplish this?

    Regards

    Uffe 

    Monday, April 22, 2013 10:45 AM

Answers

  • After spending some time doing other cool stuff with OData I finally got back to looking at this and got it working. If anybody is interested just post and i'll give a description.

    Regards

    Uffe

    • Marked as answer by Uffe Lauesen Friday, August 9, 2013 5:31 PM
    Friday, August 9, 2013 5:31 PM

All replies

  • Hi Uffe,

    Thanks for your post.

    I'll try to involve other engineers in this thread. It may take some time to get the response.

    Your patience is appreciated.

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 24, 2013 7:31 AM
    Moderator
  • Thanks,

    So any news on this? Is it a bug in the documentation or the code? Any workarounds?

    Kind regards

    Uffe

    Wednesday, May 1, 2013 2:56 AM
  • Hi Uffe,

    I have involved other senior engineers in this thread. Maybe they haven't got the result of the issue now. They will post here when there are any ideas.

    Sorry for any inconvenience and have a nice day!

    Best regards,


    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 1, 2013 8:53 AM
    Moderator
  • Hi Uffe,

    From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Thanks,

    Kunal (MSFT)

    Monday, May 20, 2013 6:17 PM
  • Hi Kunal,

    Thanks for taking the time to respond.

    Could you at least comment on why it is not possible to construct an EntityPropertyMappingAttribute whith a null/empty namespace when the documentation clearly state it is valid and should put it in the default namespace?

    Is it a bug? And could we expect a fix for it?

    Regards

    Uffe

    Monday, May 20, 2013 6:42 PM
  • After spending some time doing other cool stuff with OData I finally got back to looking at this and got it working. If anybody is interested just post and i'll give a description.

    Regards

    Uffe

    • Marked as answer by Uffe Lauesen Friday, August 9, 2013 5:31 PM
    Friday, August 9, 2013 5:31 PM
  • Hi Uffe,

    Post :-)

    It would be nice to know what you did.

    Best ,

    Daniel

    Thursday, July 9, 2015 1:16 PM