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

时间:2012-10-19 05:38:40

标签: 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>

当我尝试通过轴codegen生成java时,它会显示以下错误:

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

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

1 个答案:

答案 0 :(得分:1)

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

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

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

                                                          ^
                                                          |
                                                          |
                                                      close tag

通常,在生成绑定之前不需要发布WSDL(在服务器上安装应用程序)。