gpt4 book ai didi

android - 使用 cxf 在 Android 设备上创建 web 服务?

转载 作者:行者123 更新时间:2023-11-30 02:18:11 25 4
gpt4 key购买 nike

我能够使用 Apache CXF 在桌面 java 中创建网络服务。但是我需要它才能在 Android 设备上工作。

问题是 java.ws 包在 Android 中不存在。我已经将所有需要的带有 java.ws 类的 jar 复制到 android 项目的 libs 文件夹中,但是在 dexing 时(在 IDE 中构建应用程序)我有下一个错误:

Error:Android Pre Dex: [android-ws-combine.jar] trouble processing "javax/xml/bind/Binder.class":
Error:Android Pre Dex: [android-ws-combine.jar] Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:Android Pre Dex: [android-ws-combine.jar] when not building a core library.
Error:Android Pre Dex: [android-ws-combine.jar] This is often due to inadvertently including a core library file
Error:Android Pre Dex: [android-ws-combine.jar] in your application's project, when using an IDE (such as
Error:Android Pre Dex: [android-ws-combine.jar] Eclipse). If you are sure you're not intentionally defining a
Error:Android Pre Dex: [android-ws-combine.jar] core class, then this is the most likely explanation of what's
Error:Android Pre Dex: [android-ws-combine.jar] going on.
Error:Android Pre Dex: [android-ws-combine.jar] However, you might actually be trying to define a class in a core
Error:Android Pre Dex: [android-ws-combine.jar] namespace, the source of which you may have taken, for example,
Error:Android Pre Dex: [android-ws-combine.jar] from a non-Android virtual machine project. This will most
Error:Android Pre Dex: [android-ws-combine.jar] assuredly not work. At a minimum, it jeopardizes the
Error:Android Pre Dex: [android-ws-combine.jar] compatibility of your app with future versions of the platform.
Error:Android Pre Dex: [android-ws-combine.jar] It is also often of questionable legality.
Error:Android Pre Dex: [android-ws-combine.jar] If you really intend to build a core library -- which is only
Error:Android Pre Dex: [android-ws-combine.jar] appropriate as part of creating a full virtual machine
Error:Android Pre Dex: [android-ws-combine.jar] distribution, as opposed to compiling an application -- then use
Error:Android Pre Dex: [android-ws-combine.jar] the "--core-library" option to suppress this error message.
Error:Android Pre Dex: [android-ws-combine.jar] If you go ahead and use "--core-library" but are in fact
Error:Android Pre Dex: [android-ws-combine.jar] building an application, then be forewarned that your application
Error:Android Pre Dex: [android-ws-combine.jar] will still fail to build or run, at some point. Please be
Error:Android Pre Dex: [android-ws-combine.jar] prepared for angry customers who find, for example, that your
Error:Android Pre Dex: [android-ws-combine.jar] application ceases to function once they upgrade their operating
Error:Android Pre Dex: [android-ws-combine.jar] system. You will be to blame for this problem.
Error:Android Pre Dex: [android-ws-combine.jar] If you are legitimately using some code that happens to be in a
Error:Android Pre Dex: [android-ws-combine.jar] core package, then the easiest safe alternative you have is to
Error:Android Pre Dex: [android-ws-combine.jar] repackage that code. That is, move the classes in question into
Error:Android Pre Dex: [android-ws-combine.jar] your own package namespace. This means that they will never be in
Error:Android Pre Dex: [android-ws-combine.jar] conflict with core system classes. JarJar is a tool that may help
Error:Android Pre Dex: [android-ws-combine.jar] you in this endeavor. If you find that you cannot do this, then
Error:Android Pre Dex: [android-ws-combine.jar] that is an indication that the path you are on will ultimately
Error:Android Pre Dex: [android-ws-combine.jar] lead to pain, suffering, grief, and lamentation.
Error:Android Pre Dex: [android-ws-combine.jar] 1 error; aborting

我该怎么做?在 Android 上公开网络服务的任何其他方式/方法?

附言。 android-ws-combine.jar 已下载here .

PPS。实际上我不认为像 javax.ws 这样的桌面包被真正使用过,除了注释。我认为 webservice 实现类完全在 CXF 中。

最佳答案

好的,我做到了——必须修补 cxf 核心、cxf 传输、cxf 发现 api、将 jaxb 移植到 android、修补 txw、编辑 wsdls 和 bundle 默认 wsdls(如 ws-addressing)、修补资源加载(作为所有META/* resources are removed by android builder), patch getting package annotations (not supported by android).为期 2 周的 10 小时调试/修补和 udp 数据包拦截

关于android - 使用 cxf 在 Android 设备上创建 web 服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28958039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com