XML & Web services: How to send information & file in Java web service on Weblogic?
Hi, I'm quite new to web services, so I'm not sure which approach I should use for the above mentioned requirement. What I need to do is to send some information about a document (author, version, date created, etc.) together with the document itself through a java web service running on Weblogic using SOAP messaging. So far I have tried using the DataHandler class to send the document as a SOAP attachment and I have tried to send the document information as a custom type (return type of web service is a Java class Object with various parameter eg. docProfile with attributes author, version, date) through SOAP (document-wrapped style). They both work fine on their own. But I have no idea how to send both the document and the document information together in a SOAP message. Can someone enlighten me? Using BEA Weblogic workshop 8.14 Thanks!
- Posted by: JH Goh
- Posted on: September 27 2006 12:42 EDT
- Re: How to send information & file in Java web service on Weblogic? by Bhagvan K on September 27 2006 21:32 EDT
I guess you are asking about soap messages with attachments : SOAPMessage message = messageFactory.createMessage(); // Get the SOAP part and set its content to domSource SOAPPart soapPart = message.getSOAPPart(); soapPart.setContent(domSource); SOAPBody body = message.getSOAPBody(); SOAPBodyElement docElement = body.addDocument(document); This link below may help : http://java.sun.com/j2ee/1.4/docs/tutorial/doc/SAAJ2.html Bhagvan K http://www.jroller.com/page/bhagvank