Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert SOAP to straight XML

Status
Not open for further replies.

daveofgv

Programmer
Apr 1, 2010
2
US
Hello all,

I have a SOAP XML file that I need to remove the SOAP elements at response time.

What I have at the top is:
Code:
?
<soap:Header>
?
<wsa:Action>
xxxxxxx
</wsa:Action>
<wsa:MessageID>xxxxxxxx</wsa:MessageID>
<wsa:RelatesTo>xxxxxxxx</wsa:RelatesTo>
?
<wsa:To>
[URL unfurl="true"]http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous[/URL]
</wsa:To>
?
<wsse:Security>
?
<wsu:Timestamp wsu:Id="Timestamp-4ecfb9d8-1095-48b9-8a60-7aa0838d70a8">
<wsu:Created>2010-03-31T21:00:40Z</wsu:Created>
<wsu:Expires>2010-03-31T21:05:40Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
?
<soap:Body>

And at the bottom of the XML file:
Code:
</soap:Body>
</soap:Envelope>

When I receive the response from the webservice - is there a way to delete these elements automatically?

Thanks in advanced

daveofgv
 
Forgot to mention that I am using ASP.

Thank you
 
I would suppose you've some sort of xmlhttprequest object instantiated and obtained the response. In that case, you can do it like this.
[tt]
'suppose the xmlhttp request object is xmlhttp
if xmlhttp.responsexml.xml<>"" then 'if the response is mal-formed, it would be empty
set oxml=xmlhttp.responsexml
oxml.setProperty "SelectionLanguage", "XPath"
'[blue]modify the namespace uri to your exact case[/blue]
oxml.setProperty "SelectionNamespaces", "xmlns:soap=""[blue][ignore][/ignore][/blue]"""
set cnodes=oxml.selectnodes("//soap:Header")
for each onode in cnodes
onode.parentnode.removechild onode
next
end if
'continue of process the oxml with its soap:Header removed.
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top