简体   繁体   English

CXF 2.7.7 org.apache.cxf.interceptor.Fault:意外元素

[英]CXF 2.7.7 org.apache.cxf.interceptor.Fault: Unexpected element

I am experiencing an error I cannot understand since upgrading to CXF 2.7.7. 自升级到CXF 2.7.7以来,我遇到了我无法理解的错误。 When making a web service call CXF is reporting this exception: 进行Web服务调用时,CXF报告此异常:

org.apache.cxf.interceptor.Fault: 
Unexpected element {http://schema.myorg.com/GetReference/}ReferenceResponse found.
Expected {http://services.myorg.com/}getReferences

This makes no sense, because ReferenceResponse is exactly the response I expect. 这没有任何意义,因为ReferenceResponse正是我期望的响应。 The name getReferences appears to refer to the name of the @WebMethod annotated method that is being called. 名称getReferences似乎是指被调用的@WebMethod批注方法的名称。 The return type of this method is ReferenceResponse. 此方法的返回类型为ReferenceResponse。

What am I missing? 我想念什么?

I never found a truly satisfactory answer to this, but, it was solved when I replaced the existing client interface with one generated by wsdl2cxf. 我从未找到一个真正令人满意的答案,但是当我用wsdl2cxf生成的现有客户端接口替换了现有的客户端接口时,该问题就解决了。 This also involved migrating from Xbeans to JAXB for marshaling, which may have had something to do with it. 这还涉及从Xbeans迁移到JAXB进行封送处理,这可能与它有关。

However, in the interim adding the following annotation to the interface prevented the error. 但是,在此期间,向接口添加以下注释可防止该错误。

@EndpointProperty(key = "soap.no.validate.parts", value = "true")

I have resolved the issue when found that my SOAPLoggingHandler by default returns false in its methods. 当发现默认情况下我的SOAPLoggingHandler在其方法中返回false时,我已经解决了该问题。 It should be changed to true : 应该将其更改为true

public class SOAPLoggingHandler implements SOAPHandler<SOAPMessageContext> {
    @Override
    public Set<QName> getHeaders() {
        return null;
    }

    @Override
    public boolean handleMessage(SOAPMessageContext context) {
        SOAPMessage message= context.getMessage();
        boolean isOutboundMessage = (Boolean)context.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
        if(isOutboundMessage){
            System.out.println("OUTBOUND MESSAGE\n");

        }else{
            System.out.println("INBOUND MESSAGE\n");
        }
        try {
            message.writeTo(System.out);
        } catch (SOAPException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return true;

    }

    @Override
    public boolean handleFault(SOAPMessageContext context) {
        SOAPMessage message= context.getMessage();
        try {
            message.writeTo(System.out);
        } catch (SOAPException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return true;
    }

    @Override
    public void close(MessageContext context) { }
}

I just had this happen by adding a custom http header in my app code, specifically http keep alive. 我只是通过在我的应用程序代码中添加自定义http标头(特别是http keep live)来实现的。 The ws client http was reused and it looks like cxf was not reseting the soap action header on subsequent calls. ws客户端http已被重用,并且看起来cxf并未在后续调用中重置soap action标头。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.apache.cxf.interceptor.Fault:编组错误:null - org.apache.cxf.interceptor.Fault: Marshalling Error: null CXF:org.apache.cxf.interceptor.Fault:调用时arguments的编号错误 - CXF : org.apache.cxf.interceptor.Fault: wrong number of arguments while invoking 获取异常org.apache.cxf.interceptor.Fault:org / apache / camel / CamelContext - Getting exception org.apache.cxf.interceptor.Fault: org/apache/camel/CamelContext org.apache.cxf.interceptor.Fault:[警告] org.eclipse.jetty.io.EofException:超时 - org.apache.cxf.interceptor.Fault: [warning] org.eclipse.jetty.io.EofException: timeout org.apache.cxf.interceptor.Fault:com / itextpdf / text / Document NoClassDefFoundError - org.apache.cxf.interceptor.Fault: com/itextpdf/text/Document NoClassDefFoundError org.apache.cxf.interceptor.Fault:找不到MIME边界 - org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary org.apache.cxf.interceptor.Fault:编组错误:遇到非法字符(NULL,Unicode 0):在任何内容中均无效 - org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content org.apache.cxf.interceptor.Fault:无法初始化类net.sf.cglib.proxy.Enhancer - org.apache.cxf.interceptor.Fault: Could not initialize class net.sf.cglib.proxy.Enhancer org.apache.cxf.interceptor.Fault:无法发送消息。 引起:java.io.IOException: IOException invoking Service: Authentication failure - org.apache.cxf.interceptor.Fault: Could not send Message. Caused by: java.io.IOException: IOException invoking Service: Authentication failure 未调用Apache CXF故障拦截器 - Apache CXF Fault Interceptor not invoked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM