javax.xml.ws.soap.SOAPFaultException:无法创建抽象类

时间:2015-06-03 13:33:30

标签: java web-services soap wsdl

嗨,任何帮助都会成为我这个问题的好助手     知道为什么我的客户端调用web服务时出现此错误? 它是在JBoss上运行的cxf客户端。当我在我的客户端IPdfUtilitiesService_BasicHttpBindingIPdfUtilitiesService_Client上调用convert方法时,我得到了SOAPFaultException:

javax.xml.ws.soap.SOAPFaultException: Cannot create an abstract class.
            at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:157)
            at com.sun.proxy.$Proxy136.convert(Unknown Source)
            at leumi.pdfutilities.service.IPdfUtilitiesService_BasicHttpBindingIPdfUtilitiesService_Client.convert(IPdfUtilitiesService_BasicHttpBindingIPdfUtilitiesService_Client.java:72)
            at ext.mesarim.out.Html2PdfConverter.getPdf(Html2PdfConverter.java:73)
            at ext.mesarim.out.Html2PdfConverter.getPdf(Html2PdfConverter.java:127)
            at ext.mesarim.out.MesarimHtmlParser.parse(MesarimHtmlParser.java:142)
            at calypsox.tk.bo.document.GatewayMesarimDocumentSender.send(GatewayMesarimDocumentSender.java:136)
            at com.calypso.engine.advice.SenderEngine.handleEvent(SenderEngine.java:358)
            at com.calypso.engine.advice.SenderEngine.process(SenderEngine.java:217)
            at com.calypso.engine.Engine$EngineThread.run(Engine.java:1413)
Caused by: org.apache.cxf.binding.soap.SoapFault: Cannot create an abstract class.
            at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
            at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51)
            at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40)
            at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
            at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
            at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
            at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
            at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
            at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:845)
            at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1624)
            at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1513)
            at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1318)
            at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
            at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632)
            at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
            at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
            at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)
            at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
            at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
            at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
            at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
            at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
                ... 9 more

My wsdl :


<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions name="PdfUtilitiesService"
      targetNamespace="http://Leumi/PdfUtilities/Service/2015/04" 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="http://Leumi/PdfUtilities/Service/2015/04" 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: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">

      <!--  <wsp:Policy wsu:Id="BasicHttpBinding_IPdfUtilitiesService_policy">

            <wsp:ExactlyOne>

                  <wsp:All>
                        <http:NegotiateAuthentication
                              xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" />
                  </wsp:All>
            </wsp:ExactlyOne>
      </wsp:Policy>-->

      <wsdl:types>

            <xsd:schema targetNamespace="http://Leumi/PdfUtilities/Service/2015/04/Imports">
                  <xsd:import
                        schemaLocation="http://ntas107704t67/WsPdfUtilities/PdfUtilitiesService.svc?xsd=xsd0"
                        namespace="http://Leumi/PdfUtilities/Service/2015/04" />
                  <xsd:import
                        schemaLocation="http://ntas107704t67/WsPdfUtilities/PdfUtilitiesService.svc?xsd=xsd1"
                        namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
                  <xsd:import
                        schemaLocation="http://ntas107704t67/WsPdfUtilities/PdfUtilitiesService.svc?xsd=xsd2"
                        namespace="http://schemas.datacontract.org/2004/07/System.Drawing" />
            </xsd:schema>
      </wsdl:types>

      <wsdl:message name="IPdfUtilitiesService_Convert_InputMessage">
            <wsdl:part name="parameters" element="tns:Convert" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_Convert_OutputMessage">
            <wsdl:part name="parameters" element="tns:ConvertResponse" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_Modify_InputMessage">
            <wsdl:part name="parameters" element="tns:Modify" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_Modify_OutputMessage">
            <wsdl:part name="parameters" element="tns:ModifyResponse" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_Merge_InputMessage">
            <wsdl:part name="parameters" element="tns:Merge" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_Merge_OutputMessage">
            <wsdl:part name="parameters" element="tns:MergeResponse" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_GetFileInfo_InputMessage">
            <wsdl:part name="parameters" element="tns:GetFileInfo" />
      </wsdl:message>

      <wsdl:message name="IPdfUtilitiesService_GetFileInfo_OutputMessage">
            <wsdl:part name="parameters" element="tns:GetFileInfoResponse" />
      </wsdl:message>

      <wsdl:portType name="IPdfUtilitiesService">

            <wsdl:operation name="Convert">
                  <wsdl:input
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/Convert"
                        message="tns:IPdfUtilitiesService_Convert_InputMessage" />
                  <wsdl:output
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/ConvertResponse"
                        message="tns:IPdfUtilitiesService_Convert_OutputMessage" />
            </wsdl:operation>

            <wsdl:operation name="Modify">
                  <wsdl:input
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/Modify"
                        message="tns:IPdfUtilitiesService_Modify_InputMessage" />
                  <wsdl:output
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/ModifyResponse"
                        message="tns:IPdfUtilitiesService_Modify_OutputMessage" />
            </wsdl:operation>

            <wsdl:operation name="Merge">
                  <wsdl:input
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/Merge"
                        message="tns:IPdfUtilitiesService_Merge_InputMessage" />
                  <wsdl:output
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/MergeResponse"
                        message="tns:IPdfUtilitiesService_Merge_OutputMessage" />
            </wsdl:operation>

            <wsdl:operation name="GetFileInfo">
                  <wsdl:input
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/GetFileInfo"
                        message="tns:IPdfUtilitiesService_GetFileInfo_InputMessage" />
                  <wsdl:output
                        wsaw:Action="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/GetFileInfoResponse"
                        message="tns:IPdfUtilitiesService_GetFileInfo_OutputMessage" />
            </wsdl:operation>
      </wsdl:portType>

      <wsdl:binding name="BasicHttpBinding_IPdfUtilitiesService"
            type="tns:IPdfUtilitiesService">
            <!-- <wsp:PolicyReference URI="#BasicHttpBinding_IPdfUtilitiesService_policy" /> -->
            <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

            <wsdl:operation name="Convert">
                  <soap:operation
                        soapAction="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/Convert"
                        style="document" />

                  <wsdl:input>
                        <soap:body use="literal" />
                  </wsdl:input>

                  <wsdl:output>
                        <soap:body use="literal" />
                  </wsdl:output>
            </wsdl:operation>

            <wsdl:operation name="Modify">
                  <soap:operation
                        soapAction="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/Modify"
                        style="document" />

                  <wsdl:input>
                        <soap:body use="literal" />
                  </wsdl:input>

                  <wsdl:output>
                        <soap:body use="literal" />
                  </wsdl:output>
            </wsdl:operation>

            <wsdl:operation name="Merge">
                  <soap:operation
                        soapAction="http://Leumi/PdfUtilities/Service/2015/04/IPdfUtilitiesService/Merge"
                        style="document" />

                  <wsdl:input>
                        <soap:body use="literal" />
                  </wsdl:input>

                  <wsdl:output>
                        <soap:body use="literal" />
                  </wsdl:output>
            </wsdl:operation>

            <wsdl:operation
...

1 个答案:

答案 0 :(得分:0)

  

任何方式IPdfUtilitiesService都是客户端的接口。

这是问题。

您必须在其中一个实现类中实现此IPdfUtilitiesService接口,假设类名为serviceImpl。在此类中,您必须覆盖wsdl中的所有操作(方法)。

 public class serviceImpl implements IPdfUtilitiesService{ 

   @Override
    Convert
   @Override
    Modify
   @Override
    Merge
   @Override
    GetFileInfo

}

我认为你忘了在这里覆盖/定义Convert方法,结果你的serviceImpl类变得抽象,因为它没有实现IPdfUtilitiesService接口的所有方法。导致上述错误。

Read this用于java中的抽象概念。

  

注意到实现接口的类必须实现   所有界面的方法。但是,可以定义一个   提供的类没有实现所有接口的方法   该类被声明为抽象。