简体   繁体   English

适用于Android的Web服务的JAVA和JAVAX核心导入

[英]JAVA and JAVAX core imports for Web Services with Android

I'm working on developing an app for Android tablets that's meant as a way to read credit cards and process the payments through a client's NetSuite ERP system. 我正在开发适用于Android平板电脑的应用程序,该应用程序旨在通过客户的NetSuite ERP系统读取信用卡并处理付款。 I used wsdl2java from Apache.CFX to generate the java files for NetSuite's web services. 我使用Apache.CFX的wsdl2java生成NetSuite Web服务的Java文件。 However, most of the class files import from javax.xml and javax.jws. 但是,大多数类文件都是从javax.xml和javax.jws导入的。

As a means to resolve this, as Eclipse would not compile when using rt.jar in the project library, I used jarjar to refactor rt.jar so that those references were instead made to ns.javax. 作为解决此问题的一种方法,由于在项目库中使用rt.jar时Eclipse无法编译,因此我使用jarjar重构rt.jar,以便将这些引用改为ns.javax。 Doing this and bringing the refactor jar into the library eliminated the errors piled up in the Problems tab. 这样做并将重构jar放入库中,可以消除“问题”选项卡中堆积的错误。 However, it still wouldn't compile, as Java core references were still being made. 但是,由于仍在进行Java核心引用,因此它仍无法编译。

So I made the next logical step, and with jarjar refactored all java and javax. 因此,我进行了下一个逻辑步骤,并使用jarjar重构了所有java和javax。 Now I get new errors, for the most part now all stemming from the following all over the web services classes: 现在,我得到了新的错误,现在大部分都是由于以下所有Web服务类引起的:

The constructor QName(string, string) is undefined

I changed the import to remove the new class prefix, but then just created new errors as various other classes and objects couldn't be defined throughout the web services files. 我更改了导入以删除新的类前缀,但是由于无法在整个Web服务文件中定义其他各种类和对象,因此刚创建了新的错误。

I can't seem to find much in the way of relevant resources to get this working as all of my searches turn up references to other NetSuite apps for Android that are available, and nothing about consuming the web services on the Android platform. 我似乎找不到足够的相关资源来使此工作正常进行,因为我所有的搜索都指向对其他可用的适用于Android的NetSuite应用程序的引用,而与在Android平台上使用Web服务无关。 Right now, I can only guess that I'm going about this in a half-correct fashion at best. 现在,我只能猜测我最多只能以半正确的方式进行此操作。

Are there libraries out there I can use to replace rt.jar that will work on the Android platform? 是否有可用的库替换我可以在Android平台上运行的rt.jar?

---- EDIT ---- ----编辑----

I thought I'd add an example of some of the core imports being made causing this issue... 我以为我会举例说明一些导致此问题的核心进口商品...

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;

I was able to generate Android-compatible web services classes from a wsdl by using EasyWSDL.com . 我可以通过使用EasyWSDL.com从wsdl生成与Android兼容的Web服务类。 I had to modify a few class files, though, as it generated methods that exceeded the 64k limit Java imposes upon method size. 但是,我不得不修改一些类文件,因为它生成的方法超出了Java对方法大小的64k限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM