File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Newbie XML question with SOAP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Newbie XML question with SOAP" Watch "Newbie XML question with SOAP" New topic
Author

Newbie XML question with SOAP

JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Hi all,
With soap apache 2.3, the RPC/Literal mode exchanges org.w3c.dom.Element objects.
Once the "Element" receive on the WebService side, I would like to work with a org.w3c.dom.Document.
How can I build one from the Element I received ?
plz help.


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
When you get the Element, it is already a member of a Document created from the SOAP message. Do you have an existing Document you want to move it to or what?
Bill
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Bill,
Let's me explain further my problem.

Using RPC/Literal, I receive an "Element" as method's argument.
To deal with this "element", that is, to be able to traverse it and to read the information it contains, I would like to create a new "Document" objet, and to "insert" the "Element" into to the "Document".
Why do I want to do that ? :
Because it sounds like it is easier to work with a DOM document than with an "Element", but maybe I'm wrong

But for instance, if I want to use a TreeWalker (org.w3c.dom.traversal), my understanding is that I need a DOM Document. So the "Element" I receive from my SOAP call is not enough.
BTW : The only way out I found to create a DOCUMENT from an ELEMENT is to use a javax.xml.transform.Transformer
It sounds like it is working, but I worry about performance issues

Any though is appreciated.
I'm a bit confused, and I'm sure my explanation are not really clear. Sorry
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
But when you get an Element, it is already a member of a Document - the SOAP message is a Document with a <SOAP-ENV:Envelope> root. You should be able to use it with all DOM methods directly. Try the getOwnerDocument() method on your Element and see what you get.
Bill
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
I'll try that, thanks for the tip
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Thanks Bill.
It sounds like the getOwnerDocument() method is what I was looking for.
 
Don't get me started about those stupid light bulbs.
 
subject: Newbie XML question with SOAP