- Joined
- Mar 21, 2012
- Messages
- 2
- Reaction score
- 0
- Points
- 1
NSString *urlString=@"http://projdemo.com/MobileWebServices/Service.asmx";
soapRequestStr = [self CreateRequest];
NSString* soapAction;
soapAction =@"http://www.projdemo.com/FetchAll";
urlRequest=NULL;
responseData=NULL;
httpBodyData=[soapRequestStr dataUsingEncoding: NSUTF8StringEncoding];
url=[[NSURL alloc]initWithString: urlString];
urlRequest = [NSMutableURLRequest requestWithURL:url];
[urlRequest setHTTPMethod"POST"];
[urlRequest setHTTPBody:httpBodyData];
[urlRequest setValue"projdemo.com" forHTTPHeaderField"Host"];
[urlRequest setValue"text/xml; charset=utf-8" forHTTPHeaderField"Content-Type"];
[urlRequest setValueNSString stringWithFormat"%d",[soapRequestStr length]]
forHTTPHeaderField"Content-Length"];
[urlRequest setValue:soapAction forHTTPHeaderField"SOAPAction"];
responseData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil
error:nil];
response = nil;
error = nil;
responseString=NULL;
responseString = [[NSString alloc] initWithData:responseData
encoding:NSASCIIStringEncoding];
NSLog(@"data is %@",responseData);
NSLog(@"Response string is %@",responseString);
soapRequestStr is the XML file formatted string we are going to pass to server. Here its working fine, when URL changed to https its getting response as
Error Response:
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.20 (Ubuntu) Server at projdemo.com Port 443</address>
</body></html>
My problem is how to send soap request to https server
soapRequestStr = [self CreateRequest];
NSString* soapAction;
soapAction =@"http://www.projdemo.com/FetchAll";
urlRequest=NULL;
responseData=NULL;
httpBodyData=[soapRequestStr dataUsingEncoding: NSUTF8StringEncoding];
url=[[NSURL alloc]initWithString: urlString];
urlRequest = [NSMutableURLRequest requestWithURL:url];
[urlRequest setHTTPMethod"POST"];
[urlRequest setHTTPBody:httpBodyData];
[urlRequest setValue"projdemo.com" forHTTPHeaderField"Host"];
[urlRequest setValue"text/xml; charset=utf-8" forHTTPHeaderField"Content-Type"];
[urlRequest setValueNSString stringWithFormat"%d",[soapRequestStr length]]
forHTTPHeaderField"Content-Length"];
[urlRequest setValue:soapAction forHTTPHeaderField"SOAPAction"];
responseData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil
error:nil];
response = nil;
error = nil;
responseString=NULL;
responseString = [[NSString alloc] initWithData:responseData
encoding:NSASCIIStringEncoding];
NSLog(@"data is %@",responseData);
NSLog(@"Response string is %@",responseString);
soapRequestStr is the XML file formatted string we are going to pass to server. Here its working fine, when URL changed to https its getting response as
Error Response:
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.20 (Ubuntu) Server at projdemo.com Port 443</address>
</body></html>
My problem is how to send soap request to https server