java - 指定的 WSDL 无效!,请在代码生成器上显示的上一页上选择经过验证的 *.wsdl/*.xml 文件

标签 java eclipse wsdl

我正在使用 Axis2 codegen 向导从 wsdl 生成 java 类。

我的示例 wsdl 如下

<definitions name="HelloService"
   targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <message name="SayHelloRequest">
      <part name="firstName" type="xsd:string"/>
   </message>
   <message name="SayHelloResponse">
      <part name="greeting" type="xsd:string"/>
   </message>

   <portType name="Hello_PortType">
      <operation name="sayHello">
         <input message="tns:SayHelloRequest"/>
         <output message="tns:SayHelloResponse"/>
      </operation>
   </portType>

   <binding name="Hello_Binding" type="tns:Hello_PortType">
   <soap:binding style="rpc"
      transport="http://schemas.xmlsoap.org/soap/http"/>
   <operation name="sayHello">
      <soap:operation soapAction="sayHello"/>
      <input>
         <soap:body
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            namespace="urn:examples:helloservice"
            use="encoded"/>
      </input>
      <output>
         <soap:body
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            namespace="urn:examples:helloservice"
            use="encoded"/>
      </output>
   </operation>
   </binding>

   <service name="Hello_Service">
      <documentation>WSDL File for HelloService</documentation>
      <port binding="tns:Hello_Binding" name="Hello_Port">
         <soap:address
            location="http://www.examples.com/SayHello/">
      </port>
   </service>
</definitions>

当我尝试通过 axis codegen 生成 java 时,它显示此错误:

 Specified WSDL is invalid!, Please select a validated *.wsdl/*.xml file on previous page

如何验证我的 wsdl 以及我的 wsdl 出了什么问题?

最佳答案

您的 WSDL 的问题是您没有关闭 soap:address 标记。替换

<soap:address location="http://www.examples.com/SayHello/">

<soap:address location="http://www.examples.com/SayHello" />

                                                          ^
                                                          |
                                                          |
                                                      close tag

一般来说,在生成绑定(bind)之前不需要发布 WSDL(在服务器上安装应用程序)。

关于java - 指定的 WSDL 无效!,请在代码生成器上显示的上一页上选择经过验证的 *.wsdl/*.xml 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12967995/

相关文章:

java - 匈牙利风格成员的 Eclipse 中的 getter 和 setter

java |网络服务错误

java - java中的PubSub模型

java - XPathFactory返回xml文档

java - 正则表达式 - 匹配数字和特殊情况

java - 从 WSDL 链接 java 访问 Web 服务

wcf - 如何隐藏WCF上的wsdl信息?

java - SelectionSort 方法将按类型对 ArrayList 进行排序

c++ - 如何在 Ubuntu 12.10 (Quantal Quetzal) 中使用 C++ 安装 Eclipse?

java - 将 libgdx 项目导入 Eclipse 时未绑定(bind)类路径变量 junit 和 log4j