CXF 错误 - 来自 wdsl 错误服务的 apache CXF gererate java 代码不包含可用端口

CXF Error - apache CXF gererate java code from wdsl error service not contain usable port

我的 wsdl 文件是:

<wsdl:definitions name="Service1" targetNamespace="http://tempuri.org/"><wsdl:types><xsd:schema targetNamespace="http://tempuri.org/Imports"><xsd:import schemaLocation="http://localhost:14560/?xsd=xsd0" namespace="http://tempuri.org/"/><xsd:import schemaLocation="http://localhost:14560/?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/></xsd:schema></wsdl:types><wsdl:message name="IService1_GetData_InputMessage"><wsdl:part name="parameters" element="tns:GetData"/></wsdl:message><wsdl:message name="IService1_GetData_OutputMessage"><wsdl:part name="parameters" element="tns:GetDataResponse"/></wsdl:message><wsdl:message name="IService1_IsPortOpen_InputMessage"><wsdl:part name="parameters" element="tns:IsPortOpen"/></wsdl:message><wsdl:message name="IService1_IsPortOpen_OutputMessage"><wsdl:part name="parameters" element="tns:IsPortOpenResponse"/></wsdl:message><wsdl:message name="IService1_OpenPort_InputMessage"><wsdl:part name="parameters" element="tns:OpenPort"/></wsdl:message><wsdl:message name="IService1_OpenPort_OutputMessage"><wsdl:part name="parameters" element="tns:OpenPortResponse"/></wsdl:message><wsdl:message name="IService1_ClosePort_InputMessage"><wsdl:part name="parameters" element="tns:ClosePort"/></wsdl:message><wsdl:message name="IService1_ClosePort_OutputMessage"><wsdl:part name="parameters" element="tns:ClosePortResponse"/></wsdl:message><wsdl:message name="IService1_OpenSocket_InputMessage"><wsdl:part name="parameters" element="tns:OpenSocket"/></wsdl:message><wsdl:message name="IService1_OpenSocket_OutputMessage"><wsdl:part name="parameters" element="tns:OpenSocketResponse"/></wsdl:message><wsdl:message name="IService1_CloseSocket_InputMessage"><wsdl:part name="parameters" element="tns:CloseSocket"/></wsdl:message><wsdl:message name="IService1_CloseSocket_OutputMessage"><wsdl:part name="parameters" element="tns:CloseSocketResponse"/></wsdl:message><wsdl:message name="IService1_SendToCOM_InputMessage"><wsdl:part name="parameters" element="tns:SendToCOM"/></wsdl:message><wsdl:message name="IService1_SendToCOM_OutputMessage"><wsdl:part name="parameters" element="tns:SendToCOMResponse"/></wsdl:message><wsdl:message name="IService1_SendToSocket_InputMessage"><wsdl:part name="parameters" element="tns:SendToSocket"/></wsdl:message><wsdl:message name="IService1_SendToSocket_OutputMessage"><wsdl:part name="parameters" element="tns:SendToSocketResponse"/></wsdl:message><wsdl:message name="IService1_SetPort_InputMessage"><wsdl:part name="parameters" element="tns:SetPort"/></wsdl:message><wsdl:message name="IService1_SetPort_OutputMessage"><wsdl:part name="parameters" element="tns:SetPortResponse"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieveState_InputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieveState"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieveState_OutputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieveStateResponse"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieve_InputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieve"/></wsdl:message><wsdl:message name="IService1_GetXmlRecieve_OutputMessage"><wsdl:part name="parameters" element="tns:GetXmlRecieveResponse"/></wsdl:message><wsdl:message name="IService1_GetXmlError_InputMessage"><wsdl:part name="parameters" element="tns:GetXmlError"/></wsdl:message><wsdl:message name="IService1_GetXmlError_OutputMessage"><wsdl:part name="parameters" element="tns:GetXmlErrorResponse"/></wsdl:message><wsdl:message name="IService1_SetConfirmFlag_InputMessage"><wsdl:part name="parameters" element="tns:SetConfirmFlag"/></wsdl:message><wsdl:message name="IService1_SetConfirmFlag_OutputMessage"><wsdl:part name="parameters" element="tns:SetConfirmFlagResponse"/></wsdl:message><wsdl:message name="IService1_SetPrintFlag_InputMessage"><wsdl:part name="parameters" element="tns:SetPrintFlag"/></wsdl:message><wsdl:message name="IService1_SetPrintFlag_OutputMessage"><wsdl:part name="parameters" element="tns:SetPrintFlagResponse"/></wsdl:message><wsdl:portType name="IService1"><wsdl:operation name="GetData"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetData" message="tns:IService1_GetData_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetDataResponse" message="tns:IService1_GetData_OutputMessage"/></wsdl:operation><wsdl:operation name="IsPortOpen"><wsdl:input wsaw:Action="http://tempuri.org/IService1/IsPortOpen" message="tns:IService1_IsPortOpen_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/IsPortOpenResponse" message="tns:IService1_IsPortOpen_OutputMessage"/></wsdl:operation><wsdl:operation name="OpenPort"><wsdl:input wsaw:Action="http://tempuri.org/IService1/OpenPort" message="tns:IService1_OpenPort_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/OpenPortResponse" message="tns:IService1_OpenPort_OutputMessage"/></wsdl:operation><wsdl:operation name="ClosePort"><wsdl:input wsaw:Action="http://tempuri.org/IService1/ClosePort" message="tns:IService1_ClosePort_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/ClosePortResponse" message="tns:IService1_ClosePort_OutputMessage"/></wsdl:operation><wsdl:operation name="OpenSocket"><wsdl:input wsaw:Action="http://tempuri.org/IService1/OpenSocket" message="tns:IService1_OpenSocket_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/OpenSocketResponse" message="tns:IService1_OpenSocket_OutputMessage"/></wsdl:operation><wsdl:operation name="CloseSocket"><wsdl:input wsaw:Action="http://tempuri.org/IService1/CloseSocket" message="tns:IService1_CloseSocket_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/CloseSocketResponse" message="tns:IService1_CloseSocket_OutputMessage"/></wsdl:operation><wsdl:operation name="SendToCOM"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SendToCOM" message="tns:IService1_SendToCOM_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SendToCOMResponse" message="tns:IService1_SendToCOM_OutputMessage"/></wsdl:operation><wsdl:operation name="SendToSocket"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SendToSocket" message="tns:IService1_SendToSocket_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SendToSocketResponse" message="tns:IService1_SendToSocket_OutputMessage"/></wsdl:operation><wsdl:operation name="SetPort"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SetPort" message="tns:IService1_SetPort_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SetPortResponse" message="tns:IService1_SetPort_OutputMessage"/></wsdl:operation><wsdl:operation name="GetXmlRecieveState"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetXmlRecieveState" message="tns:IService1_GetXmlRecieveState_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetXmlRecieveStateResponse" message="tns:IService1_GetXmlRecieveState_OutputMessage"/></wsdl:operation><wsdl:operation name="GetXmlRecieve"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetXmlRecieve" message="tns:IService1_GetXmlRecieve_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetXmlRecieveResponse" message="tns:IService1_GetXmlRecieve_OutputMessage"/></wsdl:operation><wsdl:operation name="GetXmlError"><wsdl:input wsaw:Action="http://tempuri.org/IService1/GetXmlError" message="tns:IService1_GetXmlError_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/GetXmlErrorResponse" message="tns:IService1_GetXmlError_OutputMessage"/></wsdl:operation><wsdl:operation name="SetConfirmFlag"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SetConfirmFlag" message="tns:IService1_SetConfirmFlag_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SetConfirmFlagResponse" message="tns:IService1_SetConfirmFlag_OutputMessage"/></wsdl:operation><wsdl:operation name="SetPrintFlag"><wsdl:input wsaw:Action="http://tempuri.org/IService1/SetPrintFlag" message="tns:IService1_SetPrintFlag_InputMessage"/><wsdl:output wsaw:Action="http://tempuri.org/IService1/SetPrintFlagResponse" message="tns:IService1_SetPrintFlag_OutputMessage"/></wsdl:operation></wsdl:portType><wsdl:service name="Service1"/></wsdl:definitions>

错误是:

服务{http://tempuri.org/}服务1不包含任何可用端口

并且服务是 WCF 服务并且 运行 在 http://localhost:14560


并且当我使用 axis2 创建存根 class 时出现空指针异常错误。问题是 wsdl 解析。

您的 WSDL 文件似乎有错误。

您的 WSDL 文件中缺少名称空间前缀,例如

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://..."
xmlns:wsaw="http://..."

使用像 Altova XML Spy 这样的工具来验证 WSDL 错误。在尝试生成客户端之前,请创建一个 SOAP UI 项目并尝试测试该服务。