无法将名称...解析为(n)'类型定义'零件

时间:2016-07-07 20:51:26

标签: java wsdl wsimport

我想用wsimport从WSDL文件导入代码,但我在下面收到此错误。

  

[警告] src-resolve:无法解析名称' impl:ArrayOf_tns1_IndicadorVO'到(n)'类型定义'成分

这是WSDL文件......

<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://ws.cnmpind.cnmp.gov.br" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ws.cnmpind.cnmp.gov.br" xmlns:intf="http://ws.cnmpind.cnmp.gov.br" xmlns:tns1="http://vo.ws.cnmpind.cnmp.gov.br" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="http://ws.cnmpind.cnmp.gov.br" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://vo.ws.cnmpind.cnmp.gov.br"/>
   <element name="getQuestionariosDisponiveis">
    <complexType>
     <sequence>
      <element name="email" type="xsd:string"/>
      <element name="senha" type="xsd:string"/>
      <element name="dataInicio" type="xsd:string"/>
      <element name="dataFinal" type="xsd:string"/>
      <element name="areaAtuacao" type="xsd:string"/>
     </sequence>
    </complexType>
   </element>
   <element name="getQuestionariosDisponiveisResponse">
    <complexType>
     <sequence>
      <element maxOccurs="unbounded" name="getQuestionariosDisponiveisReturn" type="tns1:QuestionarioVO"/>
     </sequence>
    </complexType>
   </element>
   <complexType name="ArrayOf_tns1_IndicadorVO">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item" type="tns1:IndicadorVO"/>
    </sequence>
   </complexType>
   <element name="salvaRespostasQuestionarios">
    <complexType>
     <sequence>
      <element name="email" type="xsd:string"/>
      <element name="senha" type="xsd:string"/>
      <element name="dataInicio" type="xsd:string"/>
      <element name="dataFinal" type="xsd:string"/>
      <element name="areaAtuacao" type="xsd:string"/>
      <element maxOccurs="unbounded" name="questionarios" type="tns1:QuestionarioVO"/>
     </sequence>
    </complexType>
   </element>
   <element name="salvaRespostasQuestionariosResponse">
    <complexType/>
   </element>
  </schema>
  <schema elementFormDefault="qualified" targetNamespace="http://vo.ws.cnmpind.cnmp.gov.br" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://ws.cnmpind.cnmp.gov.br"/>
   <complexType name="IndicadorVO">
    <sequence>
     <element name="descricaoDescritor" nillable="true" type="xsd:string"/>
     <element name="id" type="xsd:long"/>
     <element name="idDescritor" type="xsd:int"/>
     <element name="idIndicadorPai" type="xsd:long"/>
     <element name="idQuestionario" type="xsd:long"/>
     <element name="nomeDescritor" nillable="true" type="xsd:string"/>
     <element name="ordem" type="xsd:int"/>
     <element name="tamanhoDescritor" nillable="true" type="xsd:decimal"/>
     <element name="tipoDescritor" nillable="true" type="xsd:string"/>
     <element name="valor" nillable="true" type="xsd:decimal"/>
    </sequence>
   </complexType>
   <complexType name="QuestionarioVO">
    <sequence>
     <element name="aberto" type="xsd:boolean"/>
     <element name="dataAtualizacao" nillable="true" type="xsd:string"/>
     <element name="dataInicio" nillable="true" type="xsd:string"/>
     <element name="dataTermino" nillable="true" type="xsd:string"/>
     <element name="descricaoArea" nillable="true" type="xsd:string"/>
     <element name="id" type="xsd:long"/>
     <element name="idArea" type="xsd:int"/>
     <element name="idUnidade" type="xsd:int"/>
     <element name="indicadores" nillable="true" type="impl:ArrayOf_tns1_IndicadorVO"/>
     <element name="nomeArea" nillable="true" type="xsd:string"/>
     <element name="nomeUnidade" nillable="true" type="xsd:string"/>
     <element name="nomeUsuarioAtualizacao" nillable="true" type="xsd:string"/>
     <element name="siglaUnidade" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="salvaRespostasQuestionariosResponse">

      <wsdl:part element="impl:salvaRespostasQuestionariosResponse" name="parameters"/>

   </wsdl:message>

   <wsdl:message name="getQuestionariosDisponiveisResponse">

      <wsdl:part element="impl:getQuestionariosDisponiveisResponse" name="parameters"/>

   </wsdl:message>

   <wsdl:message name="getQuestionariosDisponiveisRequest">

      <wsdl:part element="impl:getQuestionariosDisponiveis" name="parameters"/>

   </wsdl:message>

   <wsdl:message name="salvaRespostasQuestionariosRequest">

      <wsdl:part element="impl:salvaRespostasQuestionarios" name="parameters"/>

   </wsdl:message>

   <wsdl:portType name="QuestionarioWS">

      <wsdl:operation name="getQuestionariosDisponiveis">

         <wsdl:input message="impl:getQuestionariosDisponiveisRequest" name="getQuestionariosDisponiveisRequest"/>

         <wsdl:output message="impl:getQuestionariosDisponiveisResponse" name="getQuestionariosDisponiveisResponse"/>

      </wsdl:operation>

      <wsdl:operation name="salvaRespostasQuestionarios">

         <wsdl:input message="impl:salvaRespostasQuestionariosRequest" name="salvaRespostasQuestionariosRequest"/>

         <wsdl:output message="impl:salvaRespostasQuestionariosResponse" name="salvaRespostasQuestionariosResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="QuestionarioWSSoapBinding" type="impl:QuestionarioWS">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getQuestionariosDisponiveis">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getQuestionariosDisponiveisRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getQuestionariosDisponiveisResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="salvaRespostasQuestionarios">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="salvaRespostasQuestionariosRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="salvaRespostasQuestionariosResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="QuestionarioWSService">

      <wsdl:port binding="impl:QuestionarioWSSoapBinding" name="QuestionarioWS">

         <wsdlsoap:address location="http://aplicativos.cnmp.gov.br/cnmpind/services/QuestionarioWS"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

有人能给我一些启示吗?谢谢!

编辑1:

这只是一个警告。真正的错误是

  

package-info.java:1:错误:编写package-info时出错:可以   不创建父目录   @ javax.xml.bind.annotation.XmlSchema(namespace =   &#34; http://ws.cnmpind.cnmp.gov.br&#34;,elementFormDefault =   javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

因此,代码已生成,但编译时会发生错误。

1 个答案:

答案 0 :(得分:0)

Its seems to be a WSIMPORT bug, i don't know.

To solve the problem, I used the param "-Xnocompile" to force WSIMPORT only generate the code whithout compiling.

After that, i compiled the code by command line with javac and put the classes into a .jar

I added the .jar to the project and everything are running fine.