AXIS2客户端无法下载CXF客户端所在的附件

时间:2014-04-09 15:06:25

标签: java web-services soap axis2

我尝试使用Axis2

调用Web服务(SOAP)

使用CXF开发Web服务

我尝试调用的服务应该返回二进制文档(PDF)

使用SOAPUI,服务正确响应,我可以下载PDF

这是我使用客户端的堆栈(我使用Eclipse生成Stub)

Axis 1.6.2

JRE 1.6_45

这是我试图做的电话:

    @Test
public void process() throws RemoteException {
    DocumentService service = new DocumentServiceProxy("THE SERVICE URL");
    service.download("MY_DOCUMENT_ID");
}

这是例外:

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)

请评论我添加更多信息

更新:

通过调试服务的服务器端,这是我发现的:

WARNING: Error writing to XMLStreamWriter.
javax.xml.stream.XMLStreamException: Trying to output second root, <soap:Fault>

并在堆栈跟踪中向下

WARNING: Interceptor for {documentTarget}CXFDocumentServiceService#      {http://sei.ws.fast.cdc.com/}download has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not write attachments.

所以,我替换为AXIS客户端项目中的jar,以便使用相同的jar作为服务器端

[ woodstox-core-asl-4.3.0.jar ]取代[ wstx-asl-3.2.9.jar]

用[ stax-api-1.0-2.jar ]替换[ geronimo-stax-api_1.0_spec-1.0.1.jar ]

0 个答案:

没有答案