[jboss-user] [JBossWS] - Re: My WS doesn't send any attachment... why?

cdc08x do-not-reply at jboss.com
Fri Feb 22 07:23:07 EST 2008


Ok, I tried and used the SwAref technique many times, and everything worked perfectly.

Sadly, a new problem: when I wanted to send back to the client a List of complex objects, each with a DataHandler field, to treat as an attachment, a problem came.

In detail, here's the webservice interface method signature (btw, I'm sorry if I did not translate names from Italian):

  | ...
  | 	@WebMethod(operationName="getDocumentiRichiestaAvvioPratica")
  | 	@WebResult(name="documentiData")
  | 	List<DocumentoData> getDocumentiRichiestaAvvioPratica(
  | 			@WebParam(name="numeroIstanza") int numeroIstanza,
  | 			@WebParam(name="settore") String settore,
  | 			@WebParam(name="natura") String natura)
  | 		throws IllegalArgumentException;
  | ...
  | 

And here is the definition of DocumentoData

  | @XmlRootElement(name="DocumentoData")
  | public class DocumentoData {
  | 	/**
  | 	 * Autore del documento.
  | 	 */
  | 	@XmlAttribute(required=true)
  | 	public String autore;
  | /*
  | many other fields here...
  | */
  | 	/**
  | 	 * Contenuto binario del documento (mappato come <em>SwAref</em>, allegato SOAP)
  | 	 */
  | 	@XmlElement
  | 	@XmlAttachmentRef
  | 	public DataHandler data;
  | 
  | 	protected DocumentoData() {}
  | 
  | 	/**
  | 	 * Costruttore di istanze <code>DocumentoData</code>
  | 	 * @param autore Autore del documento
  | 	 * @param dataCreazione Data di creazione del documento
  | 	 * @param numeroDocumento Numero del documento
  | 	 * @param protocollo Protocollo del documento (può essere <code>null</code>)
  | 	 * @param nomeFile Nome del file
  | 	 * @param titolo Titolo del file
  | 	 * @param descrizione Descrizione del contenuto (può essere una stringa vuota)
  | 	 * @param data Handler dei dati fisici del file
  | 	 */
  | 	public DocumentoData(String autore, Calendar dataCreazione,
  | 			int numeroDocumento, Protocollo protocollo,
  | 			String nomeFile, String titolo, String descrizione, DataHandler data) {
  | 		this.autore = autore;
  | 		this.dataCreazione = dataCreazione;
  | 		this.numeroDocumento = numeroDocumento;
  | 		this.protocollo = protocollo;
  | 		this.nomeFile = nomeFile;
  | 		this.titolo = titolo;
  | 		this.descrizione = descrizione;
  | 		this.data = data;
  | 	}
  | }
  | 

This is the outgoing SOAP message, when the method's invocated

  | HTTP/1.1 200 OK
  | Server: Apache-Coyote/1.1
  | X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
  | Content-Type: text/xml;charset=UTF-8
  | Date: Fri, 22 Feb 2008 12:17:52 GMT
  | Connection: close
  | 
  | <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  | <env:Header>
  | </env:Header>
  | <env:Body>
  | <ns2:getDocumentiRichiestaAvvioPraticaResponse xmlns:ns2="http://www.provincia.latina.it/servizi/ws/PraticaStartWS">
  | <documentiData dataCreazione="2008-02-22T13:17:52.682+01:00" autore="Claudio Di Ciccio">
  | <numeroDocumento>14</numeroDocumento>
  | <nomeFile>RichiestaAvvio.13.A2.1244.pdf</nomeFile>
  | <titolo>Richiesta avvio procedimento - Settore Vincolo Idrogeologico - Allargamento pista camionabile</titolo>
  | <descrizione>Richiesta avvio procedimento</descrizione>
  | <data>cid:0-1203682672701-305379 at ws.jboss.org</data>
  | </documentiData>
  | <documentiData dataCreazione="2008-02-22T13:17:52.682+01:00" autore="Claudio Di Ciccio">
  | <numeroDocumento>14</numeroDocumento>
  | <nomeFile>RichiestaAvvio.13.A2.1244.pdf</nomeFile>
  | <titolo>Richiesta avvio procedimento - Settore Vincolo Idrogeologico - Allargamento pista camionabile</titolo>
  | <descrizione>Richiesta avvio procedimento</descrizione>
  | <data>cid:1-1203682672702-32409330 at ws.jboss.org</data>
  | </documentiData>
  | </ns2:getDocumentiRichiestaAvvioPraticaResponse>
  | </env:Body>
  | </env:Envelope>
  | 

That is: there's no attachment, just cids into the SOAP message.
Instead, if I send back just ONE DocumentoData object, everything works.

Could someone suggest me why?
Thank you very much, in advance

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131376#4131376

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131376




More information about the jboss-user mailing list