我正在尝试从启用了mtom的axis2客户端读取soap故障。 Axis2版本为1.6.2,适用于客户端和服务器。
与故障相关的wsdl部分:
.....
<xs:simpleType name="CodiceErroreDiTrasferimentoType">
<xs:annotation>
<xs:documentation>Codici di errore generati durante il trasferimento del pacchetto di versamento</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="ERRORE_DI_SISTEMA"/>
...
</xs:restriction>
</xs:simpleType>
....
<xs:element name="ErroreDiTrasferimento">
<xs:annotation>
<xs:documentation>Errore generato nella fase di trasferimento del pacchetto</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:restriction base="ingest:ErroreType">
<xs:sequence>
<xs:element name="Codice" type="ingest:CodiceErroreDiTrasferimentoType"/>
<xs:element name="Messaggio" type="xs:string"/>
<xs:element name="Riferimento" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
....
<wsdl:message name="IngestFault">
<wsdl:part name="fault" element="ingest:ErroreDiTrasferimento"/>
</wsdl:message>
....
<wsdl:operation name="InviaPacchettoDiVersamento">
<wsdl:input message="tns:InviaPacchettoDiVersamentoRequest"/>
<wsdl:output message="tns:InviaPacchettoDiVersamentoResponse"/>
<wsdl:fault name="IngestFault" message="tns:IngestFault"/>
</wsdl:operation>
....
<wsdl:operation name="InviaPacchettoDiVersamento">
<soap:operation soapAction="urn:InviaPacchettoDiVersamento"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="IngestFault">
<soap:fault name="IngestFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
在读取/解析IngestFault期间,会发生以下异常:
org.apache.axis2.AxisFault: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at test.cin.conserva.versamento.service.TrasferimentoStub.inviaPacchettoCompresso(TrasferimentoStub.java:1076)
at test.cin.conserva.ingest.TransferServiceTestCase.testScenarioErrore02(TransferServiceTestCase.java:188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.axiom.om.OMException: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:153)
at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176)
at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149)
at org.apache.axiom.attachments.PartImpl.getInputStream(PartImpl.java:224)
at org.apache.axiom.attachments.PartDataSource.getInputStream(PartDataSource.java:44)
at javax.activation.DataHandler.getInputStream(DataHandler.java:223)
at org.apache.axiom.attachments.MIMEMessage.getRootPartInputStream(MIMEMessage.java:196)
at org.apache.axiom.attachments.Attachments.getRootPartInputStream(Attachments.java:248)
at org.apache.axiom.attachments.Attachments.getSOAPPartInputStream(Attachments.java:224)
at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:78)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:179)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
... 31 more
Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading from source
at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114)
at org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
at org.apache.axiom.attachments.PartContentFactory.createPartContent(PartContentFactory.java:119)
... 43 more
Caused by: org.apache.james.mime4j.MimeIOException: Unexpected end of stream
at org.apache.james.mime4j.io.MimeBoundaryInputStream.verifyEndOfStream(MimeBoundaryInputStream.java:205)
at org.apache.james.mime4j.io.MimeBoundaryInputStream.readAllowed(MimeBoundaryInputStream.java:129)
at org.apache.james.mime4j.io.MimeBoundaryInputStream.read(MimeBoundaryInputStream.java:152)
at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer(BufferedLineReaderInputStream.java:111)
at org.apache.james.mime4j.io.BufferedLineReaderInputStream.read(BufferedLineReaderInputStream.java:158)
at org.apache.james.mime4j.io.LineReaderInputStreamAdaptor.read(LineReaderInputStreamAdaptor.java:67)
at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
... 45 more
Caused by: org.apache.james.mime4j.MimeException: Unexpected end of stream
... 52 more
客户端可以成功读取除soap故障之外的soap消息。
有什么建议吗? 感谢。
答案 0 :(得分:0)
我找到了解决方案:当客户端由于轴2的限制而无法解析SOAP错误时发生错误(在我的情况下,它不能解析元素ErroreDiTrasferimento作为复杂类型的限制)或者因为客户端Web服务存根未更新为当前的wsdl。
我认为轴异常不是很清楚;)