为 DLNA 服务/客户端创建 Java 存根? (或者,XML 文件中的根标记是什么?)
查看 DLNA 的规范,大多数元数据通信似乎都是基于肥皂的。但是,我找不到任何类似 WSDL 之类的各种服务的内容。相反,有某种服务描述语言,如下所示:
<scpd>
<serviceStateTable>
<stateVariable>
<Optional />
<name>TransferIDs</name>
<sendEventsAttribute>yes</sendEventsAttribute>
<dataType>string</dataType>
...
</stateVariable>
</serviceStateTable>
<actionList>
<action>
<name>Browse</name>
<argumentList>
<argument>
<name>ObjectID</name>
<direction>in</direction>
<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
</argument>
...
</argumentList>
</action>
...
</actionList>
</scpd>
我找不到有关此格式的任何文档,也找不到任何工具来为其生成服务器或客户端存根,就像使用 WSDL 一样。此时,我的选择似乎是
- 创建一个 XSLT 来尝试将描述符语言转换为 wsdl
- 编写可从现有描述符语言工作的 java 代码生成工具
- 编写存根和代码以序列化/反序列化肥皂消息手动
这三个选项似乎都同样没有吸引力,尽管第一个选项似乎是最不工作的,但这并不能说明什么。对于更好地处理这个问题有什么建议吗?
Looking at the specifications for DLNA, most of the metadata communication appears to be soap based. However I can't find anything like a WSDL for any of the various services. Instead there is some sort of service description language that looks like this:
<scpd>
<serviceStateTable>
<stateVariable>
<Optional />
<name>TransferIDs</name>
<sendEventsAttribute>yes</sendEventsAttribute>
<dataType>string</dataType>
...
</stateVariable>
</serviceStateTable>
<actionList>
<action>
<name>Browse</name>
<argumentList>
<argument>
<name>ObjectID</name>
<direction>in</direction>
<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
</argument>
...
</argumentList>
</action>
...
</actionList>
</scpd>
I can't find any documentation on this format or any tools to generate server or client stubs for it like I can with a WSDL. At this point my options appear to be
- Create an XSLT to try to transform the descriptor language into wsdl
- Write java code generation tools that work from the existing descriptor language
- Write stubs and code to serialize/deserialize the soap messages by hand
All three options seem pretty equally unappealing, though the first seems like the least work, not that that's saying much. Any suggestions for getting a better handle on the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终使用代码生成工具手动解析 XML 并创建客户端和服务器存根。
I ultimately used a code generation tool to parse the XML manually and create client and server stubs.
如果有帮助,ohNet 使用类似的方法为每个 UPnP 服务创建一个类(在您的选择 C++、C#、Java、JavaScript 或 C)来处理所有肥皂消息的序列化(反序列化)。
In case it helps, ohNet uses a similar approach to create a class per UPnP service (in your choice of C++, C#, Java, JavaScript or C) which handles all (de)serialization of soap messages.