What DataHandlers do is provide an interface to data available in various 'data 
sources' and 
it doesn't look like you are using it for the right reasons. If the export() 
function that your are using is available as a url, you can use a url 
datasource and that should take care of your problem. 
If none of these are possible, then you should think of some other mechanism 
such as plain byte array. My suggestion would still be to use temp files. 
Writing to a file and deleting it may not be as bad as you think. In fact we 
are using this mechanism to send dynamically generated reports  as dime 
attachments.

Jai


-----Original Message-----
From: Shawn Konopinsky [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 03, 2005 4:24 PM
To: axis-user@ws.apache.org
Subject: RE: Dime Attachments


Sorry for the multiple emails.. Just to be clear, the "easy" solution
doesn't really work for us because we need to stream the data across the
wire. Sometimes we can have attachments that are gigs in size, so we need to
stream them into the output stream passed into the writeTo method.

Shawn.

> -----Original Message-----
> From: THOMAS, JAI [AG-Contractor/1000] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 02, 2005 4:50 PM
> To: 'axis-user@ws.apache.org'
> Subject: RE: Dime Attachments
>
>
> I doubt what is happening on server side in your case is the following
>    - deserialize datahandler using
> JAFDataHandlerDeserializerFactory since that
>      is the standard type mapping for DataHandler.
>
>    - JAFDataHandlerDeserializerFactory creates a standard
> DataHandler which invokes
>      the standard writeTo() which asks for input stream. And you
> know what happens next.
>
> I can think of two solutions:
>   simple: on client side, store the output of
> 'export(OutputStream out)' to a file and
>           create datahandler using "new DataHandler(new
> FileDataSource(file))"
>
>   harder: Implement your own serializer/deserializer factory to
> create your 'own' datahandler
>   and register type mapping using that.
>
> Hope it helps.
>
> Jai
>
>
>
> -----Original Message-----
> From: Shawn Konopinsky [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 02, 2005 3:27 PM
> To: axis-user@ws.apache.org
> Subject: RE: Dime Attachments
>
>
> I would if I could :) Perhaps if I explain, you could offer a
> suggest on how
> to do this.
>
> The information that is to become the attachment comes from an
> already built
> part of our system. Essentially we have an object called InformationSource
> which contains all the information we need for the reply. This object
> already has a function "export(OutputStream out)" which takes an
> OutputStream and pumps all the formatted information into it.
>
> To build this structure into the Axis architecture, we created a
> InfoDataHandler which contains an instance of our InformationSource. The
> InfoDataHandler also has a NullDataSource which contains the get/sets for
> the ContentType and Name. However, we throw exceptions when a request is
> made for the InputStream or OutputStream from the NullDataSource
> (obviously
> because none exist). The logic is that the InfoDataHandler has an
> over-written writeTo(OutputStream) method that essentially just
> calls on our
> InformationSource's export(OutputStream) method.
>
> Obviously the Dime attachment code needs the InputStream from the
> DataSource. Any idea how we might work with our existing code, yet provide
> the requirements to get Dime functional?
>
> Shawn.
>
> > -----Original Message-----
> > From: THOMAS, JAI [AG-Contractor/1000] [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 02, 2005 4:06 PM
> > To: 'axis-user@ws.apache.org'
> > Subject: RE: Dime Attachments
> >
> >
> > Axis maight not be using your datahandler implementation during
> > deserialization.
> > Why don't you try using standard datahandler with a valid
> > datasource and see if that
> > fixes your problem?
> >
> > Jai
> >
> > -----Original Message-----
> > From: Shawn Konopinsky [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 02, 2005 2:57 PM
> > To: axis-user@ws.apache.org
> > Subject: RE: Dime Attachments
> >
> >
> > It would seem as if Dime is requesting a InputStream from the
> > DataSource in
> > my DataHandler. I'm using a "NullDataSource" object which just a place
> > holder, and my DataHandler is an extension of the DataHandler
> > object with an
> > over-written writeTo(..) method. This allows me to get the
> information for
> > the writeTo from another source.
> >
> > Why would Dime require an InputStream from the DataSource?
> >
> > Shawn.
> >
> > > -----Original Message-----
> > > From: Shawn Konopinsky [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, March 02, 2005 3:41 PM
> > > To: axis-user@ws.apache.org
> > > Subject: RE: Dime Attachments
> > >
> > >
> > > Has anyone seen this error before:
> > >
> > >      [java]  faultString: java.io.IOException: DIME header
> less than 12
> > > bytes.
> > >      [java]  faultActor:
> > >      [java]  faultNode:
> > >      [java]  faultDetail:
> > >      [java]
> > > {http://xml.apache.org/axis/}stackTrace:java.io.IOException:
> > > DIME header less than 12 bytes.
> > >      [java]     at
> > > org.apache.axis.attachments.DimeDelimitedInputStream.readHeader(Di
> > > meDelimite
> > > dInputStream.java:319)
> > >
> > > Not too sure what could be causing this.
> > >
> > > Shawn.
> > >
> > > > -----Original Message-----
> > > > From: Flores, Raul [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, February 28, 2005 5:16 PM
> > > > To: axis-user@ws.apache.org
> > > > Subject: RE: Dime Attachments
> > > >
> > > >
> > > >
> > > > I used the following test code to return various size files formated
> > > > DIME from a server, and it worked (lookes like what you have). If I
> > > > remember correctly, looking at messages via TCPMonitor, the
> > message with
> > > > DIME looks bizarro (as compared to MIME). So if you are saying that
> > > > things do not work because of the message format (as listed below);
> > > > possibly things are working?
> > > >
> > > >
> > > > Raul
> > > >
> > > >
> > > >
> > > >
> > > >  public com.lmtas.swa.services.DimResData
> > > > getDime(com.lmtas.swa.services.DimReqData parameters) throws
> > > > java.rmi.RemoteException {
> > > >
> > > >         DimResData drd = new DimResData("Your file is
> > attached DIME ");
> > > >         MessageContext msgContext =
> > MessageContext.getCurrentContext();
> > > >         Message msg = msgContext.getResponseMessage();
> > > >
> > > > msg.getAttachmentsImpl().setSendType(Attachments.SEND_TYPE_DIME);
> > > >         AttachmentPart part = new AttachmentPart(new DataHandler(new
> > > > FileDataSource("c:/java/testFile.txt")));
> > > >         part.setContentId("testFile.txt");
> > > >         msg.addAttachmentPart(part);
> > > >         // 2.5M
> > > >         part = new AttachmentPart(new DataHandler(new
> > > > FileDataSource("C:/Documents and Settings/My
> > > > Documents/Understanding_Web_Services_Security.pdf")));
> > > >
> part.setContentId("Understanding_Web_Services_Security.pdf");
> > > >         msg.addAttachmentPart(part);
> > > >         // 15M
> > > >         // part = new AttachmentPart(new DataHandler(new
> > > > FileDataSource("C:/Documents and Settings/My Documents/My
> > > > Downloads/axis-1_2beta3-src.zip")));
> > > >         // 410M
> > > >         // part = new AttachmentPart(new DataHandler(new
> > > > FileDataSource("C:/Documents and Settings/My
> > > > Documents/en_office_2003_pro.iso")));
> > > >
> > > >         return drd;
> > > >     }
> > > >
> > > > -----Original Message-----
> > > > From: Shawn Konopinsky [mailto:[EMAIL PROTECTED]
> > > > Sent: Monday, February 28, 2005 3:26 PM
> > > > To: axis-user@ws.apache.org
> > > > Subject: Dime Attachments
> > > >
> > > > I have what seems to be a problem with send DIME
> attachments in SOAP.
> > > >
> > > > Mime works just fine for me when I use the following to set the send
> > > > type:
> > > > reply.getAttachmentsImpl().setSendType(Attachments.SEND_TYPE_MIME).
> > > >
> > > > However, when I make the simple modification to the line
> above to use
> > > > DIME as the send type (replace Attachments.SEND_TYPE_MIME with
> > > > Attachments.SEND_TYPE_DIME), it doesn't work.
> > > >
> > > > Is there anything additional that I have to do aside from
> setting the
> > > > attachment type to DIME to switch between a MIME and DIME attachment
> > > > type?
> > > >
> > > > I am viewing the request/response through Axis' TCP Tunnel
> > viewer. When
> > > > I run through a request with DIME, the response from the
> server looks
> > > > like
> > > > this:
> > > > ------------------------
> > > > HTTP/1.1 200 OK
> > > > Set-Cookie: JSESSIONID=754354ADC18D3D950CEACF80F0191805; Path=/bind
> > > > Content-Type: application/dime;charset=utf-8
> > > > Date: Mon, 28 Feb 2005 20:50:51 GMT
> > > > Server: Apache-Coyote/1.1
> > > > Connection: close
> > > >
> > > > > > > >  "xsd:int">1</totalRecordsFound>
> > > >    <records xsi:type="xsd:string">see attachment</records>
> > > >    <query xsi:type="xsd:string">(+(+RecordType:(interaction complex
> > > > pathway ) +(gi:(4757840 )))) -((+BINDInteraction.a.type:&quot;not
> > > > specified&quot; +BINDInteraction.a.shortlabel:&quot;Unknown&quot;)
> > > > (+BINDInteraction.b.type:&quot;not specified&quot;
> > > > +BINDInteraction.b.shortlabel:&quot;Unknown&quot;))</query>
> > > >    <returnType xsi:type="xsd:string">xml</returnType>
> > > >   </multiRef>
> > > >  </soapenv:Body>
> > > > </soapenv:Envelope>
> > > > ------------------------
> > > >
> > > > As you can see it seems as if the response is malformed. Not sure if
> > > > this is a result of the problem, or something wrong with the
> > proxy that
> > > > I am using to view the response. It is stumping me because
> MIME works
> > > > fine, and DIME give me the weird result above. No exceptions
> > seem to be
> > > > thrown from the SOAP server.
> > > >
> > > > Has anyone else had a problem like this or know how I might
> > troubleshoot
> > > > it?
> > > >
> > > >
> > >
> > >
> >
> >
>
>

Reply via email to