Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Newbie XML question with SOAP

 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try that, thanks for the tip
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill.
It sounds like the getOwnerDocument() method is what I was looking for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic