1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| -(IBAction) OK
{
NSString *userName;
NSString *password;
NSString *clientCode;
password =[[NSString alloc]initWithString:[logSaisie text]];
userName =[[NSString alloc]initWithString:[pasSaisie text]];
clientCode=[[NSString alloc]initWithString:[clntCode text]];
NSString *req=@"verifyUser";
NSString *vers=@"1.0";
// Prepare message for authentication
soapResults = [[NSMutableString alloc] init];
[soapResults appendString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
[soapResults appendString:@"<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/\">"];
[soapResults appendString:@"<soap:Body>"];
[soapResults appendString:@"<verifyUser xmlns=\"http://tempuri.org/\">"];
[soapResults appendString:@"<clientCode>"];
[soapResults appendString:clientCode];
[soapResults appendString:@"</clientCode>"];
[soapResults appendString:@"<request>"];
[soapResults appendString:req];
[soapResults appendString:@"</request>"];
[soapResults appendString:@"<version>"];
[soapResults appendString:vers];
[soapResults appendString:@"</version>"];
[soapResults appendString:@"<userName>"];
[soapResults appendString:userName];
[soapResults appendString:@"</userName>"];
[soapResults appendString:@"<password>"];
[soapResults appendString:password];
[soapResults appendString:@"</password>"];
[soapResults appendString:@"</verifyUser >"];
[soapResults appendString:@"</soap:Body>"];
[soapResults appendString:@"</soap:Envelope>"];
NSLog(@"%@",soapResults);
NSString * server = [[NSString alloc]initWithString:@"https://54808.erply.com"];
NSString *test3 = [server stringByAppendingString:@"/api"];
NSURL *serviceUrl = [NSURL URLWithString:test3];
request = [NSMutableURLRequest requestWithURL:serviceUrl];
[request addValue:@"text/xml; charset:UTF-8" forHTTPHeaderField:@"Content-Type"];
NSString *test13=[server stringByAppendingString:@"https://54808.erply.com/api/verifyUser"];
[request addValue:test13 forHTTPHeaderField:@"SOAPAction"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[soapResults dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (conn) {
NSLog(@"hello, connection is good");
datas=[[NSData data]retain];
NSError * WSerror;
NSURLResponse *WSresponse;
datas = [NSURLConnection sendSynchronousRequest:request returningResponse:&WSresponse error:&WSerror];
NSLog(@"%@",datas);
}
[conn release];
webData=[[NSMutableData alloc] initWithData:datas]; |
Partager