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?
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.
Joined: May 11, 2012
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.
Joined: Sep 21, 2011
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 :-)