[jdom-interest] using jdom with apache soap

sanjay gupta sanjaygupta at myrealbox.com
Fri Aug 16 21:13:11 PDT 2002


Hi Stephen,
I have used jdom with apache soap and its workig pretty neat. I havent got any numbers for performance factor, buts its working well without any glitch.
 Here is some code for you to make use of...


//Convert your jdom element to w3c.dom.element
//assume "base" is your jdom.Element
DOMOutputter domOutputter = new DOMOutputter();
org.w3c.dom.Element element= domOutputter.output(base);

//code for sending message            
Envelope sendEnv = new Envelope();
Body sendBody = new Body();
Vector bodyEntry = new Vector();
bodyEntry.add(element.getFirstChild());

sendBody.setBodyEntries(bodyEntry);
sendEnv.setBody(sendBody);

Message soapMessage = new Message();
soapMessage.setSOAPTransport (m_shConnection);
                  
soapMessage.send(url, "", sendEnv);
            
// get the response envelope
Envelope responseEnv = soapMessage.receiveEnvelope();
// get the body
Body responseBody = responseEnv.getBody();
//get the w3c.dom.element
element = (org.w3c.dom.Element) responseBody.getBodyEntries().firstElement();
            
//convert w3c.dom.Element to jdom.Element
Reader reader = new StringReader(element.toString());
SAXBuilder saxBuilder = new SAXBuilder();
org.jdom.Document document = saxBuilder.build(reader);
           
base = document.getRootElement();    
*********************************

I hope this helps you out.
Regards,
Sanjay         



-----Original Message-----
From: "stephen chan" <stephenc at netnation.com>
To: <jdom-interest at jdom.org>
Date: Fri, 16 Aug 2002 17:55:36 -0700 
Subject: [jdom-interest] using jdom with apache soap

Hello:

 

I am wondering if anyone is using jdom with apache SOAP?

In particular, creating a jdom document from SOAP’s
(Envelope)env.getBody().getBodyEntries();

 

Thanks

Stephen

 

 



Yesterday is just a memory
Tomorrow we may never see
Today is like a gift
That's why its called the present



More information about the jdom-interest mailing list