org.apache.cxf.interceptor.Fault:找不到MIME边界

时间:2016-07-26 00:09:17

标签: java web-services cxf jax-ws mime

尝试解决抱怨缺少MIME边界的问题。

我正在调用soap webservice,看起来像是解析响应的异常?谁知道任何可能的原因?

2016-07-25 18:39:51.373 +0000 [lcbatch-scheduler_Worker-1] [WARN] o.a.cxf.phase.PhaseInterceptorChain   - Interceptor for {http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/}ErpIntegrationServiceService#{http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/}uploadFileToUcm has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: ------=_Part_679_384721743.1469471991267
        at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:60)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1641)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1532)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1330)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:652)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
        at com.sun.proxy.$Proxy156.uploadFileToUcm(Unknown Source)

apache cxf依赖我正在使用:

+- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.1.2:compile
[INFO] |  |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-core:jar:3.1.2:compile
[INFO] |  |  |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] |  |  |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] |  |  |  \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.1:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.1.2:compile
[INFO] |  |  |  +- org.apache.cxf:cxf-rt-wsdl:jar:3.1.2:compile
[INFO] |  |  |  |  \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] |  |  |  \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.1.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-bindings-xml:jar:3.1.2:compile
[INFO] |  |  +- org.apache.cxf:cxf-rt-frontend-simple:jar:3.1.2:compile
[INFO] |  |  \- org.apache.cxf:cxf-rt-ws-addr:jar:3.1.2:compile
[INFO] |  |     \- org.apache.cxf:cxf-rt-ws-policy:jar:3.1.2:compile
[INFO] |  |        \- org.apache.neethi:neethi:jar:3.0.3:compile
[INFO] |  \- org.apache.cxf:cxf-rt-transports-http:jar:3.1.2:compile

1 个答案:

答案 0 :(得分:1)

您正在接收Multipart消息(如https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html所述)。

您可以首先验证标题“Content-Type”的值。它应该像

Content-Type : multipart/related; type="application/xop+xml"; boundary="----=_Part_679_384721743.1469471991267"

然后,您可以检查响应的内容,这可能会让您了解缺少的内容。 为了检查内容,您可以使用Wiremock作为代理拦截通过线路的所有内容(http://wiremock.org/docs/proxying/)。例如,我最近这样做了,Wiremock为我录制了这个

--uuid:0a6c8ffe-9f63-4fdb-a416-43acd1044b8b
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

<soap:Envelope   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body> <myxml>....</myxml></soap:Body></soap:Envelope>
--uuid:0a6c8ffe-9f63-4fdb-a416-43acd1044b8b--

就我而言, uuid:0a6c8ffe-9f63-4fdb-a416-43acd1044b8b 是MIME边界。