Hi All, I am new to SOAP so please forgive me if I mix apples and oranges here. I have a java web app that uses soap and I need to parse a SoapMessage object. I would like to use the parse method of a SAXParser object to do this. I have found a tutorial on using a SAXParser by extending an org.xml.sax.helpers.DefaultHandler class, but the example expects a user to parse a file, not a SOAPMessage. The parse method seems to expect a path to a file, and I am having trouble finding resources on making this work for a SOAPMessage. A lot of sites recommend using Axis, but I must work with SOAP as this is how another app I communicate with is set up. Could anyone point me at a good resource that I could use that will help me to parse a javax.xml.soap.SOAPMessage object using SAX ? Thanks! Kim
Well, there's the API documentation for a start. If you look at it, you will see that there are several overloaded versions of parse that allow you to parse not only from a File, but also (for example) from an InputStream.
But looking at the API documentation for SOAPMessage, I see that you can get a SOAPBody object from it, and a SOAPHeader object, and so on. The documentation for those two objects says that they implement org.w3c.Element. In other words, the parsing is already done for you if you get those objects. You can just use ordinary DOM-wrangling techniques to access the data.
Joined: May 17, 2001
Thank you, that makes sense, maybe I am making this harder than it has to be. I will take a look at that. Kim