This might be similar to a problem we faced some time ago. 

Getting a ('non-small') file from the server two times in a row makes
the client program hang on the second file. This affected all methods
that transferred files from server to client using Axis and Java
DataHandler. 

Getting a very small file (a few bytes) inbetween the two previous calls
and everything works. 

Running TCPMonitor on the server-client communication showed that the
request call from the client that comes AFTER a getFile() call contains
the previously received attachments! It turns out that the automatically
generated code from the wsdl2java erroneously calls setAttachments()
using the attachment of the previous call! 

In other words: the error was in the client side
<MyService>SoapBindingStub.java that Axis/wsdl2java generated for us.
(or we were using the generated code erroneously...  :-)  ) 

Commenting out the setAttachments() and extractAttachments() in all
methods in <MyService>SoapBindingStub.java in the client solved this
problem for us. 

Good luck!


Regards

Roy Willy Haug

 

> -----Original Message-----
> From: Ian van der Neut [mailto:[EMAIL PROTECTED]
> Sent: 24. juni 2005 11:32
> To: axis-user@ws.apache.org
> Subject: Re: second call to ws hangs on client side.
> 
> 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