Question

I'm trying to read a soap fault from an axis2 client, with mtom enabled. Axis2 version is 1.6.2, both for client and server.

The wsdl part related to the fault:

 .....

 <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>

During the reading/parsing of the IngestFault this exception occurs:

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

The client can successfully read soap message other than soap faults.

Any suggestion? Thanks.

Was it helpful?

Solution

I found the solution: the error occurs when the client cannot parse the SOAP fault because of limitation of axis 2 (in my case it cannot parse the element ErroreDiTrasferimento as a restriction of a complex type) or because the client web service stub is not updated to the current wsdl.

I think the axis exception is not very clear ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top