• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

1 more problem with web services

 
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning,
i have a web service, live on the web, it can be accessed by a browser by www.mytest.gr/serv/myservice.asmx. Its a .NET web service.


When i try this code it returns
04-07 12:06:21.177: ERROR/error message getData(6344): expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@43ba3ad0)

if i put the url on the web browser(on android device and on my laptop) it works great. It returns my string from the web service. When i try to access it through my application it returns the error above..

cant figure out what is wrong..

one more thing,
this is returned from the web service, copy paste from firefox browser on laptop,

<string>[{"CategoryID":1,"CategoryName":"Βραχιόλια"},{"CategoryID":6,"CategoryName":"Δαχτυλίδι"},{"CategoryID":4,"CategoryName":"Καρφίτσες"},{"CategoryID":7,"CategoryName":"Κολιέ με σύρμα"},{"CategoryID":8,"CategoryName":"Κολιέ με χρωματιστά κορδόνια"},{"CategoryID":12,"CategoryName":"Μαρτυρικά"},{"CategoryID":5,"CategoryName":"Σετ"},{"CategoryID":9,"CategoryName":"Σκουλαρίκια κρίκοι"},{"CategoryID":11,"CategoryName":"Σκουλαρίκια με ημιπολύτιμες πέτρες"},{"CategoryID":10,"CategoryName":"Σκουλαρίκια μόνο μέταλλο"}]</string>
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You do not have a well formed JSON string as your output. http://www.jsonlint.com is very helpful.



<string></string> is incorrect ... here's my JSON string output:

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
good morning,
the JSON string is valid. I use KSOAP2 to get the JSON string from the web service. The weird thing is that i have a web service for other application, same concept, different data, and works perfectly. I cant seem to get the error message. Something else, when calling a web service that is hosted live on a web server, do i have to use the domain name or the actual ip address??

thanks again.
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning,
Because i see that using KSOAP2 brings up errors. One question, i have a database(access for now), i need to create some web services(.NET web services written in VB.NET). Could you give me your opinion what is the best way to get data from the database to my android application? Is there a better,easier way than the path i am following now?

Thanks in advance...
 
Ranch Hand
Posts: 136
Android Mac Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For getting Web Service data I have used this approach rather going with KSOAP. (For KSOAP I had to add 2 classes to make it work, let me know if you need those classes)


The following line will give you JSON formatted data, then feed this JSON data to parsing logic.


Hope it will help you.

Thanks
Pratik Goswami
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning,
Well the errors where not coming from my code. The code was working, my website hosting company didn't give me a dedicated IP, so my webservice couldn't find the service. So everything OK. One more question though, i need to send some data(JSON format), that i can do, but with this data i need to send an image that is at a folder in my web server, how can i send it with the other data as one JSON object? To be more specific, i have this JSON object,
PID-int
PName-string
Pdescr-string
PPrice-float
PImage-image

how can i send an image through?

thanks in advance
reply
    Bookmark Topic Watch Topic
  • New Topic