java - 如何修复 wsdl 文件错误?

标签 java xml web-services soap wsdl

亲爱的

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

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

<?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:无法将名称“tns1:JPasswordField”解析为(n)“类型定义”组件。 ImbCal.wsdl/SSPtest/WebContent/wsdl 第 196 行 WSDL 问题

  2. 描述资源路径位置类型 src-resolve:无法将名称“tns2:List”解析为(n)“类型定义”组件。 ImbCal.wsdl/SSPtest/WebContent/wsdl 第 171 行 WSDL 问题

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

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

这里是元素之一

<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>

最佳答案

这是完整的代码,我只是编辑代码中的错误并重新生成 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> 

关于java - 如何修复 wsdl 文件错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35323524/

相关文章:

ruby - 如何将xml文件转换为yaml文件?

java - 从消息响应中删除 soap header

php - 构建高度可扩展的 Web 服务

c# - 如何将 XML 读入数据集

python - BeautifulSoup 用原始 xml 替换标签而不解析/转义

java - 如何使用 hibernate 设置 UserTransaction

java - Java 中没有 Graphics2D.draw 方法?

spring - 在 Spring Rest 中使用 JSON 的 HTTP POST

java - 添加到多个其他 JPanel 时 JPanel 消失

java - SQL 多条件