1) As I see in the source code of ManagedMemoryDataSource, it does not use
at all provided InputStream is readall parameter == false. Is it bug?
2) I really does not understand what means maxCached parameter :(
3) I try to use my own DataSource for sending binary data as attachment.
I have wrote such class:
-------------
/*
 * Created by IntelliJ IDEA.
 * User: pavelb
 * Date: 16/06/2002
 * Time: 14:41:16
 * To change template for new class use 
 * Code Style | Class Templates options (Tools | IDE Options).
 */
package samples.test4;

import javax.activation.*;
import java.io.*;

public class BinDataSource implements DataSource
{
        private String _contentType;
        private String _name;
        private byte _data[];
        private InputStream _is;
        private OutputStream _os;
        
        public BinDataSource(String contentType, String name, byte[] data)
        {
                _contentType = contentType;
                _name = name;
                _data = data;
                _is= new ByteArrayInputStream(_data);
                _os = new ByteArrayOutputStream();
        }
        
        public InputStream getInputStream() throws IOException {return _is;}
        public OutputStream getOutputStream() throws IOException {return
_os;}
        public String getContentType() {return _contentType;}
        public String getName() {return _name;}
}
-------------

But if I use it for constructing DataHandler and returning this DataHandler
from service method, I receive exception :

What I am doing wrong? 

- Exception:
java.lang.NullPointerException
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:116)
        at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:
267)
        at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:154)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:121)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:288)
        at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:57
6)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:1027)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1125)
        at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
        at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:89)
        at samples.test4.BinDataSource.<init>(BinDataSource.java:27)
        at
samples.test4.AttTestSoapBindingImpl.getLog(AttTestSoapBindingImpl.ja
va:52)
        at
samples.test4.AttTestSoapBindingSkeleton.getLog(AttTestSoapBindingSke
leton.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider
.java:229)
        at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:
262)
        ... 37 more



------------------------------------------------------------------------
Bernshtam Pavel                                               053-398944
Certified Java 2 Programmer                             [EMAIL PROTECTED]
http://www.mutek.com                   http://www.cs.bgu.ac.il/~barnshte

Reply via email to