创建CXF的Andr​​oid设备上的web服务? [英] Create webservice on Android device with cxf?

查看:250
本文介绍了创建CXF的Andr​​oid设备上的web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够创建使用Apache CXF桌面Java web服务。但是我需要它的Andr​​oid设备上工作。

I was able to create webservice in desktop java using Apache CXF. However i need it to working on Android device.

问题是, java.ws 包在Android的缺席。我已经复制与 java.ws 类的所有所需的jar到库Android项目的文件夹中,但在德兴(建设在IDE中的应用程序)的我遇到下一个错误:

The problem is that java.ws package is absent in Android. I've copied all required jar with java.ws classes into libs folder of android project , but while dexing (building of the app in IDE) i'm having the next errors:

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上暴露web服务?

How can i do it? Any another way/approach to expose webservice on Android?

PS。 Android的WS-combine.jar被下载 rel=\"nofollow\">。

PS. android-ws-combine.jar was downloaded here.

PPS。其实我不认为任何桌面包,比如 javax.ws 真正使用,除了注解。我认为Web服务实现类是完全CXF

PPS. Actually i don't think any desktop packages like javax.ws are really used, except annotations. I think webservice implementation classes are in CXF completely.

推荐答案

好吧,我做到了 - 一个需要修补CXF核心,CXF运输,CXF发现API,端口JAXB到Android,补丁TXW,编辑WSDL和捆绑默认WSDL文件(如WS-寻址),贴片资源加载(如所有元/ *资源是由机器人制造商移除),获得补丁包注释(而不是由Android支持)。 2周10H调试/修补和UDP数据包拦截

Ok, i did it - one have to patch cxf core, cxf transport, cxf discovery api, port jaxb to android, patch txw, edit wsdls and bundle default wsdls (like ws-addressing), patch resources loading (as all META/* resources are removed by android builder), patch getting package annotations (not supported by android). 2 weeks of 10h debugging/patching and udp packets intercepting

这篇关于创建CXF的Andr​​oid设备上的web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆