Dumb question, but I just can't seem to get it to work. I'm passing in parameters and returning string values, but all I receive is: org.apache.http.conn.EofSensorInputStream. Do I need to do something special in my web service to access the parameters being passed?
A:
How are you passing parameters? In my experience with .net web services, you need to access them using soap. however, Android/Java does not have its own soap library so you need to add ksoap2 for android to your project, or write your own soap library (i suggest the first). If you google "ksoap2 for android" you should be able to find the jar, as well as some examples.
mtmurdock
2010-06-22 21:23:46
Funny thing is, I spent the first chunk of my development process using soap! Lol. I can easily pass values via soap, but, when I return them I have no way in parsing them. That's why i'm trying to use the HttpClient, so my return is in XML which I've already wrote a SAXHandler to handle the parsing. I'd much rather use kSoap if I knew how to parse the terrible "anyType{=value" response.
benjamin schultz
2010-06-22 21:27:43
its not the easiest thing, but you can parse your soap response. my soap responses actually came in the form of xml. is it your own web service? perhaps you could format the response in such a way that it would be easier for you to parse on your own, but thats essentially what you have to do.
mtmurdock
2010-06-23 00:50:49
Yeah it's my own. Basically, if I call my web service via soap and display it in a text view it's response is like this: anyType{string=Alabama; string=Alaska; string=Arizona;} I have no idea where to start to parse this response.
benjamin schultz
2010-06-23 14:44:48
you can use a combination of String.substring() and String.indexOf() to pull out the values. check out the Java/Android APIs on how to use these methods and you should be able to step through the string and extract what you need.
mtmurdock
2010-06-23 15:21:53
That does work, but the only problem is, i could get a different response depending on user input. I need some dynamic way to parse it.
benjamin schultz
2010-06-23 16:52:34
i guess you could make/use a different parser based on user input. if you can anticipate every possible input from the user, then you should be able to work it out. The other thing you can do is change your .net service to respond in xml (thus making it easier to parse)
mtmurdock
2010-06-23 17:28:44
I changed my .Net service to respond in XML and I tweaked my Parser and it works beautifully! Thanks for all your help!
benjamin schultz
2010-06-25 17:07:29
dont forget to accept. when you have a higher acceptance rate people are more likely to help you
mtmurdock
2010-06-25 17:22:16