简体   繁体   English

使用cxf从wsdl生成java代码会产生代码太大的错误

[英]Generating java code from wsdl using cxf gives code too large error

I have generated the code form wsdl to java using cxf 2.7.3 but when building the assembly I get "code too large" error. 我使用cxf 2.7.3生成了代码形式wsdl到java但是在构建程序集时我得到“代码太大”错误。 Indicating that one of the methods have exceeded java 64kb limit. 表明其中一种方法已超出java 64kb限制。 I know exactly which class and to me this seems like bug in cxf. 我确切地知道哪个类对我来说这看起来像cxf中的bug。 Actully Axis2 does the same so I was wondering if anyone knows how to solve this. Actully Axis2也是如此,所以我想知道是否有人知道如何解决这个问题。

The code I'm playing around with is provided here in path eco-api-ex / examples / java / 我玩弄提供的代码这里的路径生态API-EX /例子/ JAVA /

How can I force the code generation to split up large generated method? 如何强制代码生成拆分大型生成的方法? or should I use some external tool for this? 或者我应该使用一些外部工具吗?

[ERROR] \workspace\e-conomics\target\generated\src\main\java\com\e_conomic\Econo
micWebServiceSoap_EconomicWebServiceSoap12_Client.java:[34,23] error: code too l
arge

Don't run wsdl2java with the -client flag. 不要使用-client标志运行wsdl2java。 The _Client.java class is just a sample class to show how to use the generated service class and proxies and such. _Client.java类只是一个示例类,用于说明如何使用生成的服务类和代理等。 It's not normally needed for anything. 它通常不需要任何东西。 That SHOULD be the only class generated with a large method like that. 那应该是用这种大方法生成的唯一类。

You've got a 3MB WSDL document there. 你那里有一个3MB的WSDL文件。 (No wonder my browser was a bit unhappy when I tried to view a general XML document of that size.) It's got around 3000 elements defined in it; (当我试图查看那个大小的普通XML文档时,难怪我的浏览器有点不高兴。)它中定义了大约3000个元素; also 3k messages and 4.5k operations. 还有3k消息和4.5k操作。 I don't know exactly what you're hitting the limit in (there's a few places where registries of all entities of a particular type are constructed) but it doesn't matter too much. 我不知道你究竟在达到什么极限(有一些地方可以构建特定类型的所有实体的注册表),但这并不重要。 It's just far too large for most code to normally handle. 对于大多数正常处理的代码而言,它太大了。 (The limit you're hitting appears to be the one on the total size of bytecode for a method; hitting that is usually an indication of something somewhere else going badly awry: in this case, it's the bunker-busting WSDL document.) (你所遇到的限制似乎是方法字节码总大小的限制;点击它通常表明其他地方出现严重错误:在这种情况下,它是破坏掩体的WSDL文档。)

Constructing a cut-down version that has a much smaller set of elements, messages and operations would be an excellent idea. 构建一个包含更少元素,消息和操作的简化版本将是一个很好的主意。 Putting that cut-down version in your repository where Maven can find it (eg, in src/main/wsdl ) would also make a lot of sense, as it would stop you from downloading that 3MB document again each time you build. 将该缩减版本放在Maven可以找到它的存储库中(例如,在src/main/wsdl )也会有很大意义,因为它会阻止您在每次构建时再次下载该3MB文档。

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

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