axis2 fails to generate java from wsdl with inline schema

為{幸葍}努か 提交于 2019-12-11 10:33:07

问题


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

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>

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

Any ideas how to handle inline schemas with wsdl2java?


回答1:


Using databinding xmlbeans seems to solve the problem: -d xmlbeans.




回答2:


Which version of Axis2 are you using? I'm facing a similiar problem with version 1.6.x while everything works fine with 1.5.x and below. Could you try it with an older version? In my opinion using xmlbeans is not a solution, it's just a workaround.




回答3:


make that as inline schema in your wsdl.



来源:https://stackoverflow.com/questions/16568551/axis2-fails-to-generate-java-from-wsdl-with-inline-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!