views:

80

answers:

1

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
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
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
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
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
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
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
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
dont forget to accept. when you have a higher acceptance rate people are more likely to help you
mtmurdock