生成web service client时Error generating services

基于xfire的机制编写webservice是一种常见的开发手段,我也已经用此方法进行了近两个月的开发

无奈周一遇到个严重错误……在客户端生成过程中,WSDL文件能通过有效性验证,但在点击下一步时,error就出现了

Error generating services

java.lang.StringIndexOutOfBoundsException: String index out of range: 4

at java.lang.StringBuffer.charAt(StringBuffer.java:162)
    at org.codehaus.xfire.gen.jaxb.JAXBSchemaSupport.replaceAndUpperCase(JAXBSchemaSupport.java:235)
    at org.codehaus.xfire.gen.jaxb.JAXBSchemaSupport.getWrapperType(JAXBSchemaSupport.java:204)
    at org.codehaus.xfire.gen.jaxb.JAXBSchemaSupport.getType(JAXBSchemaSupport.java:191)
    at org.codehaus.xfire.gen.jaxb.JAXBSchemaSupport.getType(JAXBSchemaSupport.java:125)
    at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generateOperation(AbstractServiceGenerator.java:240)
    at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generate(AbstractServiceGenerator.java:123)
    at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generate(AbstractServiceGenerator.java:67)
    at org.codehaus.xfire.gen.jsr181.ServiceInterfaceGenerator.generate(ServiceInterfaceGenerator.java:49)
    at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generate(AbstractServiceGenerator.java:54)
    at org.codehaus.xfire.gen.Wsdl11Generator.generate(Wsdl11Generator.java:167)
    at com.genuitec.eclipse.ws.xfire.generator.WSGenJob.run(WSGenJob.java:246)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)



eclipse.buildId=unknown
java.version=1.6.0_13
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
Command-line arguments:  -os win32 -ws win32 -arch x86 -clean





这是个挺罕见的bug,如上面myeclipse报错的位置,是由xFire的string转换代码产生的错误,WSDL中惹麻烦的语句如下

<xsd:element maxOccurs="1" minOccurs="1" name="xURI" nillable="true" type="xsd:string" />

报错的字符串长度就是"xURI"的长度,那么,当我把其中的某些字母改为小写"xUri",问题就解决了。

经过测试,xFire不支持三个及以上字母的连续大写,这算是一个bug吧,希望在新的版本中能够修复。

但是后面有一个3大写字母连续的

<xsd:element maxOccurs="1" minOccurs="1" name="pkgDataOrURL" nillable="true" type="xsd:string" />

居然没有报错,我彻底迷惑了……

嘛,反正知道以后报这个错我知道去哪找了……

欢迎大家多多指教~

--
黄震宁
北京邮电大学电子工程学院ICN&CAD中心
Zhenning Huang,
ICN&CAD Center,
School of Electronic Engineering,
Beijing University of Posts and Telecommunications,
10 Xitucheng Road,
Haidian District.
Beijing, 100876
People's Republic of China
Email: echo aHVhbmd6aG5AZ21haWwuY29tIA0K | base64 -d


This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/2.5/

For other licenses contact author.

你可能感兴趣的:(java,eclipse,Web,webservice,MyEclipse)