MTOM does not work if the file length is zero
---------------------------------------------

                 Key: AXIS2-3682
                 URL: https://issues.apache.org/jira/browse/AXIS2-3682
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: client-api
    Affects Versions: 1.3
         Environment: axis2 1.3
            Reporter: jason zhang


I have a web service  the java method signature is like this
byte[] getfileContent(String filename);
My server code is like this
               FileDataSource src=new FileDataSource(file);

                OMFactory fac = OMAbstractFactory.getOMFactory();
                OMNamespace omNs = fac.createOMNamespace(NS, "tns");
                OMElement method = fac.createOMElement("getFileResponse", omNs);

                OMElement value = fac.createOMElement("content", omNs);
                DataHandler dh = new DataHandler(src);
                OMText text = fac.createOMText(dh, true);
                value.addChild(text);
                method.addChild(value);

                return method;

When the file length is not zero, client-server works fine. If the file is 
zero, the client reports this error
org.apache.axis2.AxisFault: Referenced Attachment not found in the MIME 
Message. ContentID:1.urn:uuid:[EMAIL PROTECTED]
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
        at 
net.sf.webcommand.ws.client.ProgramwsStub.fromOM(ProgramwsStub.java:781)
        at 
net.sf.webcommand.ws.client.ProgramwsStub.getFile(ProgramwsStub.java:175)
        at 
net.sf.webcommand.ws.client.ProgramwsTest.testexecuteProgram(ProgramwsTest.java:102)
        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 junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:230)
        at junit.framework.TestSuite.run(TestSuite.java:225)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.apache.axiom.om.OMException: Referenced Attachment not found in 
the MIME Message. ContentID:1.urn:uuid:[EMAIL PROTECTED]
        at 
org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder.getDataHandler(MTOMStAXSOAPModelBuilder.java:106)
        at 
net.sf.webcommand.ws.client.ProgramwsStub$GetFileResponse$Factory.parse(ProgramwsStub.java:3859)
        at 
net.sf.webcommand.ws.client.ProgramwsStub.fromOM(ProgramwsStub.java:748)
        ... 20 more

thanks

-jason


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to