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

mrostan do-not-reply at jboss.com
Mon Feb 25 06:14:00 EST 2008


Hi Claudio.
Well, I've tested a case very similar to yours, in the same versions (JBoss 4.2.2 with the default JBossWS: 2.0.1 SP2)

I've changed one thing from my previous suggestion, annotate the dummy field with @XmlAttachmentRef:

  | public class DocumentsSet {
  | 	@XmlAttachmentRef
  | 	String dummy;
  | 	
  | 	@XmlElement(name="Documents")
  | 	List<Document> documents;
  | }
  | 

The Document class is very similar:

  | public class Document {
  | 	public Document() {
  | 	}
  | 
  | 	public Document(String name, String fileUrl) {
  | 		this.name = name;
  | 		try {
  | 			this.data = new DataHandler(new URL(fileUrl));
  | 		} catch (MalformedURLException exc) {
  | 			exc.printStackTrace();
  | 		}
  | 	}
  | 	
  | 	String name;
  | 	
  | 	@XmlAttachmentRef
  | 	DataHandler data;
  | }
  | 

And it works here, I see a multipart message as the response, I'm using soapUI to invoke it and I can see the attachments in the result also.

So, I believe it should work for you.

Regards,
Martin

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

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



More information about the jboss-user mailing list