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

时间:2016-08-28 08:05:24

标签: java wcf wsdl cxf

我的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>
&#13;
&#13;
&#13;

错误是:

服务{{{​​3}}} Service1不包含任何可用端口

服务是WCF服务,并在http://tempuri.org/

运行

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

1 个答案:

答案 0 :(得分:0)

您的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项目并尝试测试该服务。