1

I am trying my hands on using web services in my app. I am trying to use this service:http://www.w3schools.com/webservices/tempconvert.asmx This service converts temp in celsius to fahrenheit and vice versa. So it also needs some value to convert. Please share some info on this. A code snippet will be great or any tutorial or sample app.

Thanks,

Ashutosh
  • 5,614
  • 13
  • 52
  • 84

2 Answers2

1

If you aren't familiar with HTTP, the first thing you need to do is do a bit of reading to understand the basics.

Once you understand the basics of HTTP, you can then understand that the service requires you to perform an HTTP POST to get the value you want.

If you read the documentation of the endpoint, you'll see that you need to POST to a specific resource. The contents of the POST request headers should look like this:

POST /webservices/tempconvert.asmx/CelsiusToFahrenheit HTTP/1.1
Host: www.w3schools.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

Next, you need to put some content in the request body of the POST. This request body should look like this:

Celsius=50

Where 50 is the temperature in Celsius.


Now, you need to actually translate this HTTP POST into code. Here are a number of URLs with examples:

Community
  • 1
  • 1
DigitalZebra
  • 39,494
  • 39
  • 114
  • 146
0

That Example uses SOAP, which is an XML object exchange format, I use JSON mostly, you would use YAML, or your own special layout, based on XML or any other structure you wish.

The idea is that you format your request in a way that the server will understand, and the server formats the response in a format that your app will understand, it doesn't have anything to do with actually sending the request or the response.

You can use a ready made SOAP library, a google search would be a good place for that. for JSON I use SB JSON, I haven't ever used a SOAP library on the iPhone.

Grady Player
  • 14,399
  • 2
  • 48
  • 76
  • Is there any sample code or Tutorial for that above URL demo for SOAP Request in iOS ?? – Solid Soft Jan 02 '14 at 06:44
  • @Jagdish basically soap will rely on you using your own method for creating the body of the request, the headers and application transport layer stuff should be pretty much the same. the difference being that in SOAP you would rely on something inside of the envelope for determining actions, rather than the HTTP verbs (as in REST)... – Grady Player Jan 02 '14 at 16:38