Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone Web Service NSData and PHP
    primarykey
    data
    text
    <p>I'm fairly new to iOS development and want to send a request message to a web service that I created in PHP. It will take the XML request, process and then provide a response XML message.</p> <p>However, the issue I'm having is that when sending data to the Webservice it is in NSData form.</p> <p>NSLog of the data being sent is:</p> <pre><code>&lt;3c3f786d 6c207665 7273696f etc etc ... 743e&gt; </code></pre> <p>However the PHP script is expecting an XML message like this:</p> <pre><code>&lt;?xml version="1.0" ?&gt;&lt;request-message&gt;&lt;tag-1&gt;&lt;/tag-1&gt;&lt;tag-2&gt;&lt;/tag-2&gt;&lt;/request-message&gt; </code></pre> <p>So my question is, is there a way of sending the XML without converting to data, or is there a way to convert the NSData string to readable XML on the PHP Server Side?</p> <p>Thanks in advance.</p> <p>Pazzy</p> <p>EDIT: To include request code:</p> <pre><code>// Construct the webservice URL NSURL *url = [NSURL URLWithString:@"http://localhost/web/check_data.php"]; NSString *requestXML = @"&lt;?xml version='1.0'?&gt;&lt;request-message&gt;&lt;tag-1&gt;VALUE1&lt;/tag-1&gt;&lt;tag-2&gt;VALUE2&lt;/tag-2&gt;&lt;/request-message&gt;"; NSData *data = [requestXML dataUsingEncoding:NSUTF8StringEncoding]; // Create a request object with that URL NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]; [request setHTTPBody:data]; [request setHTTPMethod:@"POST"]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload