You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Eric Lo <ec...@csis.hku.hk> on 2002/10/03 03:30:39 UTC

Building a DOC style service

Hello,
	I use the following code to write a Document style service, trying to 
transform(by XSLT) an incoming document(well-formed) via SOAP:

public class MessageService {
   public void processMessage (Envelope env, SOAPContext requestContext,
                                            SOAPContext resultContext)
   throws java.io.IOException, javax.mail.MessagingException
   {
     try{

       TransformerFactory tfactory = TransformerFactory.newInstance();

       Transformer transformer =
	tfactory.newTransformer(newStreamSource("my_XSL.xsl"));

/* problem 1: extracting well-form document from requestContext */

       transformer.transform(Source xmlSource, Result outputTarget);
     }catch (Exception e) {}

/* problem 2: returning a well-formed document */	
	resultContext.setRootPart();
   }
}

My question is:
1)How can I extract the XML wrapped inside the SOAPContext?  As I cannot 
find any useful function call except getBodyPart(int index);
2)How can I send back a well-form document thru 
SOAPcontext.setRootPart()?  Seems setRootPart don't expect me to send a 
well-formed document but a string only

Thanks,
	eric


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>