如何修复wsdl文件错误?

时间:2016-02-10 18:51:16

标签: java xml web-services soap wsdl

逗人

我尝试创建和创建Web服务,首先我创建了服务器端和wsdl文件,但我在这个wsdl文件中得到了一些错误,我尝试了很多时间来解决它,我想我应该检查xmlns或xsd。

实际上我是网络服务的新手,现在还不知道如何调查它们,请告诉我并告诉我代码中的错误。

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace"
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="http://DefaultNamespace" 
xmlns:intf="http://DefaultNamespace" 
xmlns:tns1="http://swing.javax" 
xmlns:tns2="http://awt.java"
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://DefaultNamespace" 
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://awt.java"/>
<import namespace="http://swing.javax"/>

错误是

  1. 描述资源路径位置类型 src-resolve:无法解析名称&#39; tns1:JPasswordField&#39;到(n)&#39;类型定义&#39;零件。 ImbCal.wsdl / SSPtest / WebContent / wsdl第196行WSDL问题

  2. 描述资源路径位置类型 src-resolve:无法解析名称&#39; tns2:List&#39;到(n)&#39;类型定义&#39;零件。 ImbCal.wsdl / SSPtest / WebContent / wsdl第171行WSDL问题

  3. 描述资源路径位置类型 schema_reference.4:无法读取模式文档&#39; null&#39;,因为1)找不到文档; 2)文件无法阅读; 3)文档的根元素不是。 ImbCal.wsdl / SSPtest / WebContent / wsdl第7行WSDL问题

  4. 描述资源路径位置类型 schema_reference.4:无法读取模式文档&#39; null&#39;,因为1)找不到文档; 2)文件无法阅读; 3)文档的根元素不是。 ImbCal.wsdl / SSPtest / WebContent / wsdl第8行WSDL问题

  5. 这里有一个元素

    <element name="dbSelect">
        <complexType>
         <sequence>
          <element name="sql" type="xsd:string"/>
          <element name="level" type="xsd:string"/>
          <element name="mat_sel2" type="tns2:List"/>
          <element name="mymaterial" type="tns2:List"/>
         </sequence>
        </complexType>
       </element>
    

1 个答案:

答案 0 :(得分:0)

这是完整的代码,我只是从代码中编辑错误并重新生成wsdll。

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace"
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="http://DefaultNamespace" 
xmlns:intf="http://DefaultNamespace" 
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://DefaultNamespace" xmlns="http://www.w3.org
/2001/XMLSchema">
<element name="main">
<complexType>
 <sequence>
  <element maxOccurs="unbounded" name="arg" type="xsd:string"/>
 </sequence>
</complexType>
</element>
<element name="mainResponse">
<complexType>
 <sequence>
  <element maxOccurs="unbounded" name="mainReturn" type="xsd:string"/>
  </sequence>
 </complexType>
 </element>
 <element name="finalmaterial">
 <complexType>
 <sequence>
  <element name="Couresn" type="xsd:string"/>
  <element name="IDL" type="xsd:string"/>
  <element name="Myco2" type="xsd:string"/>
  <element name="userlevel" type="xsd:int"/>
  <element name="LevelL" type="xsd:string"/>
  </sequence>
  </complexType>
  </element>
  <element name="finalmaterialResponse">
  <complexType>
  <sequence>
  <element maxOccurs="unbounded" name="finalmaterialReturn" 
  type="xsd:string"/>
  </sequence>
  </complexType>
  </element>
  </schema>
  </wsdl:types>
  <wsdl:message name="finalmaterialRequest">
  <wsdl:part element="impl:finalmaterial" name="parameters">
  </wsdl:part>
  </wsdl:message>
  <wsdl:message name="finalmaterialResponse">
  <wsdl:part element="impl:finalmaterialResponse" name="parameters">
  </wsdl:part>
  </wsdl:message>
  <wsdl:message name="mainRequest">
  <wsdl:part element="impl:main" name="parameters">
  </wsdl:part>
  </wsdl:message>
  <wsdl:message name="mainResponse">
  <wsdl:part element="impl:mainResponse" name="parameters">
  </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="ImbCal">
  <wsdl:operation name="main">
     <wsdl:input message="impl:mainRequest" name="mainRequest">
   </wsdl:input>
     <wsdl:output message="impl:mainResponse" name="mainResponse">
   </wsdl:output>
  </wsdl:operation>
  <wsdl:operation name="finalmaterial">
     <wsdl:input message="impl:finalmaterialRequest" 
   name="finalmaterialRequest">
   </wsdl:input>
     <wsdl:output message="impl:finalmaterialResponse" 
   name="finalmaterialResponse">
   </wsdl:output>
   </wsdl:operation>
   </wsdl:portType>
    <wsdl:binding name="ImbCalSoapBinding" type="impl:ImbCal">
   <wsdlsoap:binding style="document" 
   transport="http://schemas.xmlsoap.org/soap/http"/>
   <wsdl:operation name="main">
     <wsdlsoap:operation soapAction=""/>
     <wsdl:input name="mainRequest">
        <wsdlsoap:body use="literal"/>
     </wsdl:input>
     <wsdl:output name="mainResponse">
        <wsdlsoap:body use="literal"/>
     </wsdl:output>
     </wsdl:operation>
     <wsdl:operation name="finalmaterial">
     <wsdlsoap:operation soapAction=""/>
     <wsdl:input name="finalmaterialRequest">
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="finalmaterialResponse">
        <wsdlsoap:body use="literal"/>
     </wsdl:output>
     </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="ImbCalService">
      <wsdl:port binding="impl:ImbCalSoapBinding" name="ImbCal">
      <wsdlsoap:address location="http://localhost:8080/SSPwebservice
      /services/ImbCal"/>
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>