Errore lettura attachment in ws Soap

di Anonimizzato29850 il
3 risposte
Salve a tutti,
ho un problema con webservices axis soap, io ho realizzato il client e tra i vari metodi c'è uno che restituisce un file di errori solo il file è nel response.
Io ho utilizzato queste istruzionI:

				Message msg = _call.getResponseMessage();
				ByteArrayOutputStream baos = new ByteArrayOutputStream();
				try {
					String methodName = "extractAttachments : ";

					Iterator iterator = msg.getAttachments();
			
					while (iterator.hasNext()) {
						AttachmentPart attachment = (AttachmentPart) iterator
								.next();
						String id = attachment.getContentId();
						String type = attachment.getContentType();
						System.out.println(methodName + "Attachment id: " + id
								+ " - has content type " + type);

						if (type.equals("text/plain")) {
							// if the attachment is of text type, write to
							// console
							Object content = attachment.getContent();
							System.out.println(methodName
									+ "Attachment contains:\n" + content);
						} else {
							System.out.println(methodName
									+ "Attachment is not a plain text");
							 try {
								publishAttachment(attachment.getDataHandler().getInputStream(),id);
							} catch (IOException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
							}
						}
					}
				} catch (SOAPException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				String returnValue = baos.toString();
ma puntualmente ricevo questo errore: "java.io.IOException: End of stream encountered before final boundary marker."
subito nel _call.getResponseMessage().

Dove sbaglio?
Grazie
Umberto

3 Risposte

  • Così ad occhio sembrerebbe un problema del webservice.
    Pare che il messaggio venga chiuso prima che l'allegato sia stato completamente scritto nella response.
    Mi viene da pensare che l'allegato sia troppo grosso e/o che possa causare un OutOfMemoryError lato server.
  • Strano il file che deve prendere sul response è di 1,5 mb
  • La mia era una semplice supposizione data dal messaggio di errore...
    Hai verificato / hai modo di verificare se sul server dove è ospitato il WebService viene segnalato qualcosa? Un log di errore?
Devi accedere o registrarti per scrivere nel forum
3 risposte