1

我正在尝试使用 cxf 部署 Web 服务。

我使用以下代码来声明我的端点

<jaxws:endpoint
xmlns:wsdl="com_documentation_service_standardfeatures_application_webservices_uc51_webserviceServer_WebServiceSearch"  
 id="webServiceSearchEndpoint"
    implementor="#com.documentation.service.standardfeatures.application.webservices.uc51_webserviceServer.WebServiceSearch"
    wsdlLocation="classpath:resources/schemas/wsdl/com_documentation_service_standardfeatures_application_webservices_uc51_webserviceServer_WebServiceSearch.wsdl"
    endpointName="wsdl:WebServiceSearchPort"
    serviceName="wsdl:com_documentation_service_standardfeatures_application_webservices_uc51_webserviceServer_WebServiceSearch"
    address="http://localhost:8888/service2"
    />

我的wsdl看起来像这样

[...]
<wsdl:types>
<schema targetNamespace="com_documentation_service_standardfeatures_application_webservices_uc51_webserviceServer_WebServiceSearch_types" xmlns="http://www.w3.org/2001/XMLSchema"
 xmlns:team51="com_documentation_business_standardfeatures_application_webservices_uc51_webserviceClient_entities_Team51"    >
    <import namespace="com_documentation_business_standardfeatures_application_webservices_uc51_webserviceClient_entities_Team51" schemaLocation="classpath:resources/schemas/xsd/com_documentation_business_standardfeatures_application_webservices_uc51_webserviceClient_entities_Team51.xsd"/>
    <element name="team51" type="team51:team51"/>
    <element name="anyType" type="xsd:anyType"/>
    <element name="string" type="xsd:string"/>
    <element name="integer" type="xsd:integer"/>
    <element name="float" type="xsd:float"/>
    <element name="long" type="xsd:long"/>
    <element name="dateTime" type="xsd:dateTime"/>
    <element name="boolean" type="xsd:boolean"/>        
    <element name="collection" type="types:collectionType"/>        
    <complexType name="collectionType">
        <sequence>
            <element type="xsd:anyType" minOccurs="0" maxOccurs="unbounded" name="element"/>
        </sequence>
    </complexType>  
</schema>
</wsdl:types>

  <wsdl:message name="team51FindByID">
    <wsdl:part name="id" element="types:long"/>
  </wsdl:message>
  <wsdl:message name="team51FindByIDResponse">
       <wsdl:part name="return" element="types:team51"/>
  </wsdl:message>

  <wsdl:portType name="WebServiceSearch">  
   <wsdl:operation name="team51FindByID">
     <wsdl:input name="team51FindByID" message="team51FindByID">
   </wsdl:input>
    <wsdl:output name="team51FindByIDResponse" message="team51FindByIDResponse">
   </wsdl:output>
   </wsdl:operation>    
 </wsdl:portType>  
[...]

运行tomcat服务器时,总是出现以下信息。

 ATTENTION: Could not unwrap Operation {documentation_service_standardfeatures_application_webservices_uc51_webserviceServer_WebServiceSearch}team51FindByID to match method "public abstract Type1 team51FindByID(java.lang.Long)"

 org.apache.cxf.endpoint.ServerImpl initDestination

我的配置有什么问题?

4

2 回答 2

0

在该 wsdl 上运行 wsdl2java 并确保方法签名与生成的匹配。看起来您没有 @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) 注释并且该方法的返回类型是错误的。(看起来应该是 Team51,而不是 Type1)

于 2013-02-04T15:30:50.817 回答
0

您定义操作的命名空间不正确。错误正是揭示了命名空间不正确的类,因此它无法找到它并且无法解包。

修复命名空间应该使您能够正确地创建 WSDL。

于 2016-03-25T10:15:13.910 回答