iPhone Programming Tutorial – Intro to SOAP Web Services

Important Links:
[WebService] http://viium.com/WebService/HelloWorld.asmx
-After creating our XML data / SOAP request, we create a URLRequest. We add HTTP Header values, those values you read from the WebService.
-We set the HTTP Method to POST
-We set out HTTP Body to the xml file we created
-We then create our connection, using the request we just setup.

-Once the connection is setup and delegate is set to self, we need to setup out connection delegate methods.
-The first method just makes sure it can make a connection. If it can, we make sure we have no data in our Data set so we clear it.
-Second method is called when re receive any data. If we do receive data, we just append it to our data set.
-Third Method handles any errors and releases our data and connection if an error occurs.
-Fourth Method: We take the data and create a string for Logging reasons, then release the string.
-We check to make sure an instance of xmlParser does not exist, if it does we release it.
-Create a new instance of xmlParser, set the delegate to self, want to resolve external entities, and start our parsing.
-release our connection and Data

Now we need to our our delegate methods for NSXMLParser
First method we are check the start of elements. If our element equals “HelloResult” we set our BOOL to true. Second method records any data between an element if our BOOL is set to true. Third method checks for our closing element. Once found sets our greeting, releases our MutableString, and set our BOOL back to false.

If you have any questions or comments, please leave them in the comments of this post. You can download the sample code here.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>