本文介绍了axis2无法使用内联模式从wsdl生成Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从WSDL生成Java类.我正在从ant任务中调用wsdl2java.命令行如下所示:
I want to generate Java classes from a WSDL. I'm invoking wsdl2java from within an ant task. The commandline would look like this:
java -cp ... org.apache.axis2.wsdl.WSDL2Java -o generated_dir -S . -R . -l java -p "com.make.me.rich" -d adb -or --noBuildXML -uri MakeMeRich.wsdl
MakeMeRich.wsdl包含来自Micrsosoft的内联架构,例如:
The MakeMeRich.wsdl contains inlined schemas from Micrsosoft, e.g.:
<xsd:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<xsd:complexType name="ArrayOfint">
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="int" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ArrayOfint" nillable="true" type="tns:ArrayOfint" />
<xsd:complexType name="ArrayOfKeyValueOfstringstring">
<xsd:annotation>
<xsd:appinfo>
<IsDictionary xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</IsDictionary>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="unbounded" name="KeyValueOfstringstring">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Key" nillable="true" type="xsd:string" />
<xsd:element name="Value" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ArrayOfKeyValueOfstringstring" nillable="true" type="tns:ArrayOfKeyValueOfstringstring" />
</xsd:schema>
但是wsdl2java解析器发出警告:
But the wsdl2java parser gives a warning:
[java] Warning: No schemaLocation for import of http://schemas.microsoft.com/2003/10/Serialization/Arrays; compilation may fail
有什么想法如何使用wsdl2java处理内联架构吗?
Any ideas how to handle inline schemas with wsdl2java?
推荐答案
使用数据绑定xmlbeans
似乎可以解决问题:-d xmlbeans
.
Using databinding xmlbeans
seems to solve the problem: -d xmlbeans
.
这篇关于axis2无法使用内联模式从wsdl生成Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!