HTTPS data returned not saving - objective-c

I have an object class set up called WebCalls. In this class, I make a web call and return some JSON from an HTTPS server. Now the methods work perfectly, I have tested and the data returns fine. However my problem is, I can't access the data returned outside the class.
The code to retrieve the data is below
Interface
#interface WebCall : NSObject{
NSString *phoneNumber;
NSString *jsonData;
}
#property (nonatomic, retain) NSMutableData *responseData;
#property (nonatomic, retain) NSString *jsonData;
-(void) getData: (NSString *) link;
#end
Implementation
#implementation WebCall
#synthesize jsonData;
#synthesize responseData;
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0];
}
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[responseData appendData:data];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
self.responseData = nil;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *s = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
jsonData = s;
}
-(void) getData: (NSString *) link{
jsonData = [[NSString alloc] init];
self.responseData = [NSMutableData data];
NSURL * url = [NSURL URLWithString:link];
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url];
[request addValue:#"application/json" forHTTPHeaderField:#"Content-Type"];
[request setHTTPMethod:#"GET"];
[[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES];
}
#end
In interface class I have a string called jsonData. I get and set it using property and synthesise. So after I make web call, I assign the data to jsonData, and I should be able to import web call class, use the getInfo method, have the jsonData returned and then access it using
WebCall *wc = [[WebCall alloc] init];
[wc getData:url];
NSLog(#"%#", [c jsonData]);
However this just prints out null. And yet if I print out the String in the Webcall class after I recieve the data, it prints out fine. Could anyone tell me what I am doing wrong?
Thanks in advance
Edit: Updated with complete implementation
Also I can't access the string outside the method. I copied the code to another class, and tried assigning the JSON String, then calling it again in the body, and it comes out null again. Seems I can only print it out in that connection method. Then it seems to clear the String
Edit: What I tried
[wc setWebCallDidFinish:^(NSString * json, NSString *test){
NSLog(#"%#", json);
}];
[wc getData:#"12345"];

Adam the reason jsonData is an empty string is because [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES]; runs asynchronously which means on a new thread and it doesn't block. this means that when you call [wc getData:url]; and then immediately call NSLog(#"%#", [wc jsonData]); the http request hasn't completed yet and the - (void)connectionDidFinishLoading:(NSURLConnection *)connection delegate function hasn't been called yet in your WebCall.
For a detailed explanation read this iOs Concurrency Programming Guide. Essentially you need to add a notifier to your WebCall so that it can notify the object which spawns it that the request has finished loading. I would use a block like so.
#interface WebCall : NSObject{
NSString *phoneNumber;
NSString *jsonData;
void(^webCallDidFinish)(NSString *jsonData, id otherRandomVar);
}
#property (nonatomic, retain) NSMutableData *responseData;
#property (nonatomic, retain) NSString *jsonData;
-(void) getData: (NSString *) link;
-(void)setWebCallDidFinish:(void (^)(NSString *, id))wcdf;
#end
Implementation
#implementation WebCall
#synthesize jsonData;
#synthesize responseData;
-(void)setWebCallDidFinish:(void (^)(NSString *,id))wcdf{
webCallDidFinish = [wcdf copy];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *s = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
jsonData = s;
webCallDidFinish(jsonData, #"any other object");
}
//all of your other code here
Then in the calling code the following
WebCall *wc = [[WebCall alloc] init];
[wc setWebCallDidFinish:^(NSString * json, id randomSecondVar) {
NSLog(#"%#",json);
}];
[wc getData:url];
What will happen is the block of code you provide to setWebCallDidFinish will be called after jsonData is loaded. You could also use the Delegate pattern to accomplish this. Note that while this asynchronous request is loading you should provide some sort of indicator to your user.

Related

Objective C: SSL Pining

I have implement NSURLConnectionDataDelegate in my class and I have implemented the method:
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
But when I make new NSURLConnection this method isn't called. Why? Where is the problem? The connections is an SSL connection.
I have look inside an example project downloaded by internet (I don't remember where) and this project work fine, but if I do the some step in my project don't work. I need any external library or to set something in the proj? You can suggest me a for-dummies guide?
Edit 1:
In the example I use:
NSURL *httpsURL = [NSURL URLWithString:#"https://secure.skabber.com/json/"];
NSURLRequest *request2 = [NSURLRequest requestWithURL:httpsURL cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:15.0f];
NSURLConnection *connection = [NSURLConnection connectionWithRequest:request2 delegate:self];
[connection start];
But I want to work with any kind of NSURLConnection.
Edit 2:
This is my complete code:
#interface ConnectionDelegate : NSObject<NSURLConnectionDataDelegate>
#property (strong, nonatomic) NSURLConnection *connection;
#property (strong, nonatomic) NSMutableData *responseData;
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
-(void)testHTTPRequest;
#end
#implementation ConnectionDelegate
-(void)testHTTPRequest
{
NSURL *httpsURL = [NSURL URLWithString:#"https://secure.skabber.com/json/"];
NSURLRequest *request = [NSURLRequest requestWithURL:httpsURL cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:15.0f];
self.connection = [NSURLConnection connectionWithRequest:request delegate:self];
[self.connection start];
if ([self isSSLPinning]) {
[self printMessage:#"Making pinned request"];
}
else {
[self printMessage:#"Making non-pinned request"];
}
}
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, 0);
NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate));
NSData *skabberCertData = [self skabberCert];
if ([remoteCertificateData isEqualToData:skabberCertData] || [self isSSLPinning] == NO) {
if ([self isSSLPinning] || [remoteCertificateData isEqualToData:skabberCertData]) {
[self printMessage:#"The server's certificate is the valid secure.skabber.com certificate. Allowing the request."];
}
else {
[self printMessage:#"The server's certificate does not match secure.skabber.com. Continuing anyway."];
}
NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
}
else {
[self printMessage:#"The server's certificate does not match secure.skabber.com. Canceling the request."];
[[challenge sender] cancelAuthenticationChallenge:challenge];
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
if (self.responseData == nil) {
self.responseData = [NSMutableData dataWithData:data];
}
else {
[self.responseData appendData:data];
}
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *response = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
[self printMessage:response];
self.responseData = nil;
}
- (NSData *)skabberCert
{
NSString *cerPath = [[NSBundle mainBundle] pathForResource:#"secure.skabber.com" ofType:#"cer"];
return [NSData dataWithContentsOfFile:cerPath];
}
- (void)printMessage:(NSString *)message
{
Log(#"%#",message);
}
- (BOOL)isSSLPinning
{
NSString *envValue = [[[NSProcessInfo processInfo] environment] objectForKey:#"SSL_PINNING"];
return [envValue boolValue];
}
#end
If i put a breakpoint on connection:willSendRequestForAuthenticationChallenge: the program don't enter in it.

Obj-C, how to stop NSURLConnection behind NSData?

how can I stop NSURLConnection behind NSURLConnection ?
code:
NSData *sendreq = [NSURLConnection sendSynchronousRequest:urlreq returningResponse:nil error:nil];
NSString *responseStr =[[NSString alloc] initWithBytes:[sendreq bytes] length:[sendreq length] encoding:NSUTF8StringEncoding];
I use the NSData to store the response from my server, but in this way I cant use "[sendreq cancel]"
so if the NSURLConnection is making a long connection and the user is go to anther VC I want to stop the NSURLConnection, so how can I do it ?
If you want to be able to cancel your request, do not use sendSynchronousRequest, but instead use the asynchronous, delegate-based rendition NSURLConnection. (Frankly, you should avoid using synchronous requests, from the main thread at least, for a variety of reasons.) If you use the delegate-based rendition, you can then call NSURLConnection method cancel when needed.
So, define properties to hold the data and connection reference:
#property (nonatomic, strong) NSMutableData *responseData;
#property (nonatomic, weak) NSURLConnection *connection;
Then start the connection:
self.responseData = [NSMutableData data];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:urlreq delegate:self];
self.connection = connection;
You obviously have to implement the NSURLConnectionDataDelegate methods:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[self.responseData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *responseStr = [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding];
// you can use `responseStr` here
// now that we're done with `responseData`, we might want to release it
self.responseData = nil;
}
You want to detect/handle errors, too, with the NSURLConnectionDelegate method:
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
// do whatever you want when error occurs
NSLog(#"%s: %#", __FUNCTION__, error);
}
If you need to cancel it, it's
[self.connection cancel];
You could also use AFNetworking, which uses delegate-based NSURLConnection, but keeps you out of the weeds of the implementation.
You can also use the newer NSURLSession which offers block-based renditions that are still can be cancelled. But that depends upon what OS versions you're trying to support.

what's wrong with this simple code(objective c)?

i want to download some webpages ,but this example code seems doesn't work.
it prints "begin download" and then exits,why the delegates method does not be executed?
what's wrong in the example code?
thanks
main.m
#import <Foundation/Foundation.h>
#import "Test.h"
int main(int argc, const char * argv[])
{
#autoreleasepool {
Test * test = [[Test alloc]init];
[test downloadData];
}
[NSThread sleepForTimeInterval:21.0f];
return 0;
}
Test.h
#import <Foundation/Foundation.h>
#interface Test : NSObject <NSURLConnectionDelegate,NSURLConnectionDataDelegate,NSURLConnectionDownloadDelegate>
#property (retain) NSMutableData * receivedData;
#property (retain) NSURLConnection * theConnection;
- (void) downloadData;
#end
Test.m
#import "Test.h"
#implementation Test
- (void) downloadData
{
NSURLRequest *theRequest=
[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://www.sf.net/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
_receivedData = [NSMutableData dataWithCapacity: 0];
[NSURLConnection sendSynchronousRequest:theRequest
returningResponse:nil
error:nil];
NSLog(#"begin download");
if (!_theConnection) {
_receivedData = nil;
// Inform the user that the connection failed.
}
}
enter code here
#pragma mark -
#pragma mark NSURLConnectionDataDelegateenter code here methods
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(#"1");
[_receivedData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(#"2");
[_receivedData appendData:data];
}
- (void)connection:(NSURLConnection *)connection
didFailWithError:(NSError *)error
{
NSLog(#"3");
_theConnection = nil;
_receivedData = nil;
// inform the user
NSLog(#"Connection failed! Error - %# %#",
[error localizedDescription],
[[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]);
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(#"4");
NSLog(#"Succeeded! Received %lu bytes of data",(unsigned long)[_receivedData length]);
_theConnection = nil;
_receivedData = nil;
}
-(void) connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL
{
NSLog(#"5");
}
#end
you have two ways to Synchronous or Asynchonous :
In Synchronous any delegates was not called and the right line is
https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/occ/clm/NSURLConnection/sendSynchronousRequest:returningResponse:error:
_receivedData = [NSURLConnection sendSynchronousRequest:theRequest
returningResponse:nil
error:nil];
NSLog(#"begin download");
if (!_theConnection) {
_receivedData = nil;
// Inform the user that the connection failed.
}
In Asynchronous you need to use – initWithRequest:delegate:
https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/occ/instm/NSURLConnection/initWithRequest:delegate:
[NSURLConnection alloc] initWithRequest:delegate:theRequest
delegate:self];
NSLog(#"begin download");

How to get an array from NSMutableData

I have text file with 5 strings. I need to use NSURLConnection to get contnent of this file. But NSLog shows me, that 'dump' is empty. How can I transform the data from NSMutableData to NSArray. Arrays is because I need to show those 5 items in a TableView.
NSURLRequest *theRequest=[NSURLRequest
requestWithURL:[NSURL URLWithString:#"http://dl.dropbox.com/u/25105800/names.txt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
receivedData = [NSMutableData data];
NSString *dump = [[NSString alloc] initWithData:receivedData
encoding:NSUTF8StringEncoding];
NSLog(#"data: %#", dump);
NSArray *outputArray=[dump componentsSeparatedByString:#"\n"];
self.namesArray = outputArray;
Thanks in advance. BTW URL works, you can see the file.
Here's how you implement this solution with a delegate:
In your .h file:
#interface MyClass : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate>
#property (nonatomic, retain) NSMutableData *receivedData;
#property (nonatomic, retain) NSArray *namesArray;
#end
In you .m file:
#implementation MyClass
#synthesize receivedData = _receivedData;
#synthesize namesArray = _namesArray;
- (id)init {
self = [super init];
if (self) {
self.receivedData = [NSMutableData data];
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:#"http://dl.dropbox.com/u/25105800/names.txt"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
[connection start];
}
return self;
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
NSLog(#"Received response! %#", response);
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[self.receivedData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *dump = [[NSString alloc] initWithData:self.receivedData encoding:NSUTF8StringEncoding];
NSLog(#"data: %#", dump);
self.namesArray = [dump componentsSeparatedByString:#"\n"];
}
#end
If you don't want to use a delegate, you can use a synchronous call with NSURLConnection, like this:
NSURLRequest *theRequest=[NSURLRequest
requestWithURL:[NSURL URLWithString:#"http://dl.dropbox.com/u/25105800/names.txt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSError *error = nil;
NSHTTPURLResponse *response = nil;
NSData *receivedData = [NSURLConnection sendSynchronousRequest:theRequest response:&response error:&error];
if (error == nil) {
NSString *dump = [[NSString alloc] initWithData:receivedData
encoding:NSUTF8StringEncoding];
NSLog(#"data: %#", dump);
NSArray *outputArray=[dump componentsSeparatedByString:#"\n"];
self.namesArray = outputArray;
}
Just beware that this will not be running asynchronously. If you don't want it to run on the main thread and block your main thread/UI, consider using a separate thread to execute that code or use GCD.
You have to use the delegate, then save the received data into receivedData (which is of course empty right now.. you just initalized it.) and then you transform the data into a string, like you did it in your example. Have a look at NSURLConnectionDelegate
You need to implement the delegate methods for NSURLConnection to be notified of incoming data. You are using the asynchronous methods.
Also note that [NSMutableData data] just creates an empty data-object.. so you can't expect it to contain any data..
I suggest you read https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html#//apple_ref/doc/uid/20001836-BAJEAIEE
(completely!)

Xcode is not calling asp.net webservice

I have oracle database and using webservice i want to insert some records in to it
So i created webservice in asp.net as follows
public bool PickPill(string Me_id, string Mem_device_id, string Test_datetime, string Creation_id, string PillBayNo)
{
string Hed_seq_id = Hed_seq_Id();
bool ResultHED = InsHealthEData(Hed_seq_id, Mem_device_id, Me_id, Test_datetime, Creation_id);
bool ResultHET = InsHealthETest(Hed_seq_id, PillBayNo, Test_datetime, Creation_id);
if (ResultHED == ResultHET == true)
return true;
else
return false;
}
this function did all data insertion trick for me i tested this service on the local mechine with ip address
http:72.44.151.178/PickPillService.asmx
then,
I see an example on how to attach asp.net web service to iphone apps
http://www.devx.com/wireless/Article/43209/0/page/4
then i created simillar code in xcode which has 2 files
ConsumePillServiceViewController.m
ConsumePillServiceViewController.h file
Now,
Using Designer of xcode i created 5 textboxes(Me_id,Mem_device_id,Test_datetime,Creation_id,PillBayNo) with all parameters hardcode as our service demands
then modify my ConsumePillServiceViewController.h file as follows
#interface ConsumePillServiceViewController : UIViewController {
//---outlets---
IBOutlet UITextField *Me_id;
IBOutlet UITextField *Mem_device_id;
IBOutlet UITextField *Test_datetime;
IBOutlet UITextField *Creation_id;
IBOutlet UITextField *PillBayNo;
//---web service access---
NSMutableData *webData;
NSMutableString *soapResults;
NSURLConnection *conn;
}
#property (nonatomic, retain) UITextField *Me_id;
#property (nonatomic, retain) UITextField *Mem_device_id;
#property (nonatomic, retain) UITextField *Test_datetime;
#property (nonatomic, retain) UITextField *Creation_id;
#property (nonatomic, retain) UITextField *PillBayNo;
- (IBAction)buttonClicked:(id)sender;
#end
and
ConsumePillServiceViewController.m as follows
#import "ConsumePillServiceViewController.h"
#implementation ConsumePillServiceViewController
#synthesize Me_id;
#synthesize Mem_device_id;
#synthesize Test_datetime;
#synthesize Creation_id;
#synthesize PillBayNo;
- (IBAction)buttonClicked:(id)sender {
NSString *soapMsg =
#"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
"<soap:Body>"
"<PickPill xml1ns=\"http://tempuri.org/\">";
NSString *smMe_id=
[soapMsg stringByAppendingString:
[NSString stringWithFormat:
#"<Me_id>%#</Me_id>",Me_id.text]];
NSString *smMem_device_id=
[smMe_id stringByAppendingString:
[NSString stringWithFormat:
#"<Mem_device_id>%#</Mem_device_id>",Mem_device_id.text]];
NSString *smTest_datetime=
[smMem_device_id stringByAppendingString:
[NSString stringWithFormat:
#"<Test_datetime>%#</Test_datetime>",Test_datetime.text]];
NSString *smCreation_id=
[smTest_datetime stringByAppendingString:
[NSString stringWithFormat:
#"<Creation_id>%#</Creation_id>",Creation_id.text]];
NSString *smPillBayNo=
[smCreation_id stringByAppendingString:
[NSString stringWithFormat:
#"<PillBayNo>%#</PillBayNo>",PillBayNo.text]];
NSString *smRestMsg=
[smPillBayNo stringByAppendingString:
#"</PickPill>"
"</soap:Body>" "</soap:Envelope>"];
soapMsg=smRestMsg;
//---print it to the Debugger Console for verification---
NSLog(soapMsg);
NSURL *url = [NSURL URLWithString: //create a URL load request object using instances :
#"http://72.44.151.178/PickPillService.asmx"];//of the NSMutableURLRequest and NSURL objects
NSMutableURLRequest *req =
[NSMutableURLRequest requestWithURL:url];
//opulate the request object with the various headers, such as Content-Type, SOAPAction, and Content-Length.
//You also set the HTTP method and HTTP body
NSString *msgLength =
[NSString stringWithFormat:#"%d", [soapMsg length]];
[req addValue:#"text/xml; charset=utf-8"
forHTTPHeaderField:#"Content-Type"];
[req addValue:#"http://tempuri.org/PickPill"
forHTTPHeaderField:#"SOAPAction"];
[req addValue:msgLength
forHTTPHeaderField:#"Content-Length"];
//---set the HTTP method and body---
[req setHTTPMethod:#"POST"];
[req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
conn = [[NSURLConnection alloc] initWithRequest:req delegate:self]; //establish the connection with the web service,
if (conn) { //you use the NSURLConnection class together with the request object just created
webData = [[NSMutableData data] retain];//webData object use to receive incoming data from the web service
}
}//End of button clicked event
-(void) connection:(NSURLConnection *) connection //Recive response
didReceiveResponse:(NSURLResponse *) response {
[webData setLength: 0];
}
-(void) connection:(NSURLConnection *) connection //Repeative call method and append data to webData
didReceiveData:(NSData *) data {
[webData appendData:data];
}
-(void) connection:(NSURLConnection *) connection//If error occure error should be displayed
didFailWithError:(NSError *) error {
[webData release];
[connection release];
}
-(void) connectionDidFinishLoading:(NSURLConnection *) connection {
NSLog(#"DONE. Received Bytes: %d", [webData length]);
NSString *theXML = [[NSString alloc]
initWithBytes: [webData mutableBytes]
length:[webData length]
encoding:NSUTF8StringEncoding];
//---shows the XML---
NSLog(theXML);
[connection release];
[webData release];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[Me_id release];
[Creation_id release];
[Mem_device_id release];
[Test_datetime release];
[PillBayNo release];
[soapResults release];
[super dealloc];
}
#end
I did all things as shown in the website and when i built application it successfully built
but in the debuggin window i see
(gdb) continue
2010-03-17 09:09:54.595 ConsumePillService[6546:20b] <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><PickPill xml1ns="http://tempuri.org/"><Me_id>A00000004303</Me_id><Mem_device_id>1011</Mem_device_id><Test_datetime>03/13/2010 07:34:38</Test_datetime><Creation_id>Hboxdata</Creation_id><PillBayNo>2</PillBayNo></PickPill></soap:Body></soap:Envelope>
(gdb) continue
(gdb) continue
(gdb) continue
2010-03-17 09:10:05.411 ConsumePillService[6546:20b] DONE. Received Bytes: 476
2010-03-17 09:10:05.412 ConsumePillService[6546:20b] <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Server was unable to process request. ---> One or more errors occurred during processing of command.
ORA-00936: missing expression</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>
It should return me true if all things are ok
What is this ORA-00936 error all about
as it is not releted with webservice
Please help me solving this problem
Thanks in advance,
Vaibhav Deshpande