This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Services and the fly likes SOAP Response with Attachment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SOAP Response with Attachment" Watch "SOAP Response with Attachment" New topic
Author

SOAP Response with Attachment

Pattabhi ram
Greenhorn

Joined: May 11, 2012
Posts: 4
Hi,

I am new to WebServices. I have few doubts with respect to the web service SOAP attachment response.

1. How can you check whether the returned SOAP response is an attachment or not? Can the 'Content-Type' value helps? If yes, what would be value?

2. Can a response would be delivered with an attachment as well as normal text? My requirement is that, if the response has attachment, ignore the attachment and process the rest (if any content available). What is the value of 'Content-type' in this case?

A reply would be appreciated!!!

Thanks,
Ram
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
What do you mean by "whether the returned SOAP response is an attachment"? A response can have an attachment, but it's still a SOAP response like any other.
Pattabhi ram
Greenhorn

Joined: May 11, 2012
Posts: 4
Thanks for quick response Tim!!!

I meant to say that, how can we decide whether the SOAP response consists of an attachment or not? because, I receive an object of SOAP response. I am trying to decide whether my response has an attachment or not.
For that, I am checking whether the 'Content-Type' in the response is 'multipart' or not. If it is 'multipart...' then, I assume the SOAP response consists of attachment. Pleas guide me if my understanding is correct or not.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
I'd rather use proper SAAJ calls. For example, if you have a javax.xml.soap.SOAPMessage object, you can use the getAttachments method to find out how many attachments there are. On the other hand, if you're planning to ignore any attachments there might be, why bother to find out if there are any :-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SOAP Response with Attachment