I have the following soap envelope.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
        <soap:Body>
                <GetLatestSchedulesExResponse xmlns="http://www.ezitracker.com/
eziTrackerData/">
                        <GetLatestSchedulesExResult>&lt;ResultExDataset 
xmlns="http://
www.ezitracker.net/eziTrackerData/ResultExDataset.xsd"&gt;
  &lt;ResultSummary&gt;

  &lt;/ResultSummary&gt;
&lt;/ResultExDataset&gt;&lt;SchedulesDataset xmlns="http://
www.ezitracker.net/eziTrackerData/SchedulesDataset.xsd" /&gt;</
GetLatestSchedulesExResult>
                </GetLatestSchedulesExResponse>
        </soap:Body>
</soap:Envelope>

I can't for the life of me get to any of the nodes that I want in this
document. I tried to follow the documentation and wrote the following


doc=get_xml_from_file(filename)
root=doc.root

faults = root.find_first( "//soap:Fault")
        if faults != nil
         puts "SOAP FAULT: "
         p root.find("/soap:Envelope/soap:Body/soap:Fault/
faultstring").first.first
        #this works!
else
         puts "SUCCESS!"#
end

# I am trying to get this node...

#<GetLatestSchedulesExResponse xmlns="http://www.ezitracker.com/
eziTrackerData/">       <GetLatestSchedulesExResult>

register_namespace = doc.find('//ns:GetLatestSchedulesExResponse',
'ns:http://www.ezitracker.com/eziTrackerData/')

node = doc.find_first('/soap:Envelope/soap:Body/
ns0:GetLatestSchedulesExResponse')

this gives the error

Error: Undefined namespace prefix at :0.
xmlXPathEval: evaluation failed
/usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml/document.rb:
55:in `find': Error: Undefined namespace prefix at :0.
(LibXML::XML::Error)
        from /usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml/
document.rb:55:in `find'
        from /usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.9.5/lib/libxml/
document.rb:62:in `find_first'
        from /home/tim/junk/soap_test_xml.rb:165


I have tried all kinds of variations but I can't find anything that
works.

Where have I gone wrong?
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to