wcf——定制服务文档
我是 WCF 编程及其联合类等的新手。当有人尝试访问我的服务的根地址时,我尝试以编程方式生成 AtomPub 服务文档。我只能在某种程度上使用 ServiceDocument、ResourceCollectionInfo、Workspace 类来做到这一点 -
<service>
<app:workspace>
<a10:title type="text">Sample Repository</a10:title>
<app:collection href="http://some_url">
<a10:title type="text">Root Collection</a10:title>
</app:collection>
</app:workspace>
</service>
但是我想添加一些自定义属性和元素,如下所示。请注意 xmlns 属性、cmisra 元素等。msdn
<service
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<workspace>
<atom:title>Sample Repository</atom:title>
<collection href="http://some_url">
<atom:title>Root Collection</atom:title>
<cmisra:collectionType>root</cmisra:collectionType>
</collection>
</workspace>
</service>
网站或其他地方没有太多可用的信息。任何有关如何实现这一目标的意见将不胜感激。
谢谢!
谢谢。
I am new to WCF programming and its syndication classes etc. I am trying to produce a AtomPub service document programmatically when someone tries to access root address of my service. I am able to do that only to some extent using ServiceDocument, ResourceCollectionInfo, Workspace classes -
<service>
<app:workspace>
<a10:title type="text">Sample Repository</a10:title>
<app:collection href="http://some_url">
<a10:title type="text">Root Collection</a10:title>
</app:collection>
</app:workspace>
</service>
However I would like to add some custom attributes and elements as can be seen below. Please notice the xmlns attributes, cmisra elements etc.
<service
xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<workspace>
<atom:title>Sample Repository</atom:title>
<collection href="http://some_url">
<atom:title>Root Collection</atom:title>
<cmisra:collectionType>root</cmisra:collectionType>
</collection>
</workspace>
</service>
There is nothing much available on msdn website or elsewhere. Any inputs on how to achieve this would be appreciated.
Thanks!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ResourceCollectionInfo
类具有两个属性ElementExtensions
和AttributeExtensions
,可用于自定义ResourceCollectionInfo
的序列化。请注意,大多数聚合元素都具有这些扩展,它们可以与 RSS 和 Atom 格式化程序一起使用。The
ResourceCollectionInfo
class has two propertiesElementExtensions
andAttributeExtensions
which can be used to customize the serialization of aResourceCollectionInfo
. Please note that most of the syndication elements have those extensions, which work with both the RSS and Atom formatters.