gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 15:05:52 25 4
gpt4 key购买 nike

我正在使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com