View Single Post
Old 06-08-2009, 01:37 AM   #3 (permalink)
karthik25
New Member
 
Join Date: May 2009
Location: Dallas, TX
Model: 8900
PIN: N/A
Carrier: Simulator
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Doug,

Thanks a lot for your response.

I totally forgot the option of using DOM / SAX. I used the following code to parse the XML response. But I get a class cast exception. Can you please check and let me know what is wrong with this.
I would love to experiment and find it out, but the problem is that the simulator takes a lot of time to start in my machine and so it would be
great if you could help me out. I cannot figure out what I am missing.

Code:
ht.call(soapAction, envelope);

DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();			
DocumentBuilder db=dbf.newDocumentBuilder();

//I guess this part is wrong probably -- I am sure that the remaining code works
InputStream iStr =  (InputStream)envelope.getResponse();

Document dom = db.parse(iStr);

org.w3c.dom.Element docFile = dom.getDocumentElement();
docFile.normalize();

org.w3c.dom.NodeList nl_name = docFile.getElementsByTagName("PlaceName");
org.w3c.dom.Element nl_name_elem = (org.w3c.dom.Element) nl_name.item(0);
String nl_name_value = nl_name_elem.getFirstChild().getNodeValue();
result = nl_name_value;
Thanks again for responding!

Edit:

Given below is the exception I get and the string that follows after "[" is the output received by using envelope.getResponse().toString() -- truncated

java.lang.ClassCastException

[ anyType{Latiture=32.9659843;Longitude=96.74525;All ocationFactor=0.002192;FipsCode=48;PlaceName=Richa rdson;StateCode=TX;Details=anyType{WeatherData=any Type{Day=....

Regards,
Karthik

Last edited by karthik25 : 06-08-2009 at 02:03 AM.
Offline   Reply With Quote