gpt4 book ai didi

java - 无法解析 WSDL

转载 作者:行者123 更新时间:2023-12-02 12:09:22 25 4
gpt4 key购买 nike

我尝试使用以下教程从 wsdl 生成 src,但在 wsimport 时出现异常。

http://www.mkyong.com/webservices/jax-ws/jax-ws-wsgen-tool-example/

wsimport -keep -verbose http://localhost:7001/poc-war/ServerInfoService?wsdl

出现以下错误:

C:\Program Files\Java\jdk1.8.0_102\bin>wsimport -keep -verbose http://localhost:7001/poc-war/ServerInfoService?wsdl
parsing WSDL...


[ERROR] Server returned HTTP response code: 504 for URL: http://localhost:7001/poc-war/ServerInfoService?wsdl

Failed to read the WSDL document: http://localhost:7001/poc-war/ServerInfoService?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.


[ERROR] Could not find wsdl:service in the provided WSDL(s):

At least one WSDL with at least one service definition needs to be provided.


Failed to parse the WSDL.

ServerInfoService?wsdl

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.mkyong.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="ServerInfoService" targetNamespace="http://ws.mkyong.com/">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://ws.mkyong.com/" targetNamespace="http://ws.mkyong.com/">
<xsd:complexType name="getIpAddressResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="return" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="getIpAddress"/>
<xsd:element name="getIpAddressResponse" type="ns0:getIpAddressResponse"/>
<xsd:element name="getIpAddress" type="ns0:getIpAddress"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getIpAddress">
<wsdl:part element="tns:getIpAddress" name="parameters"/>
</wsdl:message>
<wsdl:message name="getIpAddressResponse">
<wsdl:part element="tns:getIpAddressResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="ServerInfo">
<wsdl:operation name="getIpAddress">
<wsdl:input message="tns:getIpAddress" name="getIpAddress"/>
<wsdl:output message="tns:getIpAddressResponse" name="getIpAddressResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServerInfoServiceSoapBinding" type="tns:ServerInfo">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getIpAddress">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="getIpAddress">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getIpAddressResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServerInfoService">
<wsdl:port binding="tns:ServerInfoServiceSoapBinding" name="ARMServicePortTypeImplPort">
<soap:address location="http://10.19.9.92:7001/poc-war/ServerInfoService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

最佳答案

这是一个网络问题。您可以在浏览器中打开 wsdl,将文本复制并粘贴到新的 .wsdl 文件中,然后从硬盘驱动器 URL 与网络 URL 重新生成它。

我曾经遇到过网络安全问题导致我无法使用某些开发工具访问 WSDL,因此在本地保留副本是可行的。我承认这充其量只是一种解决方法,但如果没有更多信息,502 的故障排除并不容易。

关于java - 无法解析 WSDL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46662358/

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