简体   繁体   中英

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

My wsdl file is:

 <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> 

Error is :

Service { http://tempuri.org/ }Service1 does not contain any usable ports

And service is WCF service and run at http://localhost:14560


And when i create stub class with axis2 have null pointer exception error. problem is wsdl parsing.

Your WSDL file seems to have errors.

You have missing namespace prefix in your WSDL file, eg

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

Use a tool like Altova XML Spy to validate WSDL errors. Before trying to generate client please create a SOAP UI project and try to test the service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM