SOAP carrying Attachments
Well, it is very simple. I am using IBM WebSphere v5.1, and it uses Axis, so this should work well with Apache-Axis also.
Getting directly to the point:
A simple java class, which we will expose as a web service:
Method is:
public DataHandler getFileAttachment(String fileName) throws Exception
{
DataSource src = new FileDataSource(fileName);
DataHandler result = new DataHandler(src);
return result;
}
That's it. DataHandler, DataSource and FileDataSource are from javax.activation package.
Just expose this as a WebService and you are all set to receive files from a Web Service, as an attachment to the SOAP message.
A sincere advice, never use byte[] getFile() as a Web Service method, even for a small file, it takes so much time, transferring one byte at a time.
Enjoy!

4 Comments:
I read over your blog, and i found it inquisitive, you may find My Blog interesting. My blog is just about my day to day life, as a park ranger. So please Click Here To Read My Blog
http://www.juicyfruiter.blogspot.com
Do you want free porn? Contact my AIM SN 'abunnyinpink' just say 'give me some pics now!'.
No age verification required, totally free! Just send an instant message to AIM screen name "abunnyinpink".
Any message you send is fine!
AIM abuse can be reported here.
Get any Desired College Degree, In less then 2 weeks.
Call this number now 24 hours a day 7 days a week (413) 208-3069
Get these Degrees NOW!!!
"BA", "BSc", "MA", "MSc", "MBA", "PHD",
Get everything within 2 weeks.
100% verifiable, this is a real deal
Act now you owe it to your future.
(413) 208-3069 call now 24 hours a day, 7 days a week.
Call for Papers Announced for SOA India 2007
This is definitely interesting information and will be trigger a lot of heated discussions on the subject. On a related note, a first of its kind conference on SOA, SaaS, BPM, MDM, Agile, BPEL, BI, Enterprise 2.0 is being held in India (Bangalore) later this year. If you are responsible for business optimisation, designing, developing and/or implementing your organisation's IT strategy this conference -- SOA India 2007 -- will equip you with the tools and information you need to implement a company wide SOA solution that deploys agile, manageable and secure technology. The Call for Papers was announced recently. Proposals can be submitted to: www.soaindia2007.com. The deadline for submission is 30 June.
Post a Comment
<< Home