当我在Linux机器上尝试从远程WSDL获取java类定义时,我收到此错误:
wsimport http://172.28.0.22:8090/Service
parsing WSDL...
[ERROR] Unable to parse "http://localhost:8090/Service?wsdl=wsdl0" : Connection refused
line 1 of http://172.28.0.22:8090/Service
[ERROR] Unable to parse "http://localhost:8090/Service?wsdl=wsdl0" : Connection refused
Failed to read the WSDL document: http://172.28.0.22:8090/Service, 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):
http://172.28.0.22:8090/Service
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
将curl http://172.28.0.22:8090/Service
导入控制台时,我收到带有主标记的正确WSDL文件。此服务不需要任何授权。
我做错了什么?为什么wsimport将URL更改为localhost?
编辑:curl
此URL提供此输出(我点缀了私人数据):
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="Service" targetNamespace="..." xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="..." xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="..." xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsdl:import namespace="..." location="http://localhost:8090/Service?wsdl=wsdl0" />
<wsdl:types>
<xsd:schema targetNamespace="...">
<xsd:import schemaLocation="http://localhost:8090/Service?xsd=xsd0" namespace="..." />
<xsd:import schemaLocation="http://localhost:8090/Service?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="http://localhost:8090/Service?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Service" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="Service_...">
<wsdl:part name="parameters" element="tns:..." />
</wsdl:message>
<wsdl:portType name="Service">
<wsdl:operation name="....">
<wsdl:input wsaw:Action="..." message="..." />
<wsdl:output wsaw:Action="..." message="..." />
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="Service">
<wsdl:port name="BasicHttpBinding_Service" binding="i0:BasicHttpBinding_Service">
<soap:address location="http://localhost:8090/Service" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>