On 6/23/05, Ian van der Neut <[EMAIL PROTECTED]> wrote:
> Hello all,
> 
> I'm having a problem with obtaining a PDF from a webservice as an
> attachment. The first time I call the web service, everything works as
> it is expected, but the second time, the client side seems to hang on
> reading the file. Here's the code:
> 
> Server:
> public javax.activation.DataHandler getProduct(java.lang.String name,
> 
>                  java.lang.String datasetName)
> 
>        throws java.rmi.RemoteException {
>    // Stuff to determine 'product' snipped.
>     javax.activation.DataHandler dh = new javax.activation.DataHandler(
>             new javax.activation.FileDataSource(product));
>     log.debug("Content type is: ["+dh.getContentType()+"]");
>     org.apache.axis.MessageContext msgCtx =
>             org.apache.axis.MessageContext.getCurrentContext();
>     org.apache.axis.Message response=msgCtx.getResponseMessage();
>     response.getAttachmentsImpl().setSendType(
>                       org.apache.axis.attachments.Attachments.SEND_TYPE_MIME);
>     org.apache.axis.attachments.AttachmentPart attachment =
>                         new org.apache.axis.attachments.AttachmentPart(dh);
>     response.addAttachmentPart(attachment);
>     log.debug("Returning product "+name);
> }

The loggings show the last log message show up. (I forgot to mention
that, sorry).

> Client:
> javax.activation.DataHandler data =
>                     service.getProduct(myForm.getProductName(),
> myForm.getName());
> if (null == data) {
>                 log.debug("No product obtained from web service.");
>                 return null;
>             }
>  log.debug("Obtaining attachment for product ["+myForm.getProductName()+"]");
> java.io.InputStream is = data.getInputStream();

This last log message doesn't show up in the loggings.

> I am using axis-1_2RC2, javamail-1.3.2, jaf-1.0.2. It works fine if
> the file is a PNG or a GIF or a HTML document instead. The PDF is of
> course bigger than all of these, I also have this problem with a
> zipped postscript file (is not unpacked, is just sent as a gzipped
> file).

I upgraded to axis 1.2.1, however, stil the same result. I've also
been searching the archives, but most attachment sending over SOAP
that is being done seems to be client-> server. This is the other way
around and it works fine for other files.

Thanks,

Ian.

Reply via email to