How to send HTTPS synchronous request to server using SOAP web services

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:mad:"POST"];
[urlRequest setHTTPBody:httpBodyData];
[urlRequest setValue:mad:"projdemo.com" forHTTPHeaderField:mad:"Host"];
[urlRequest setValue:mad:"text/xml; charset=utf-8" forHTTPHeaderField:mad:"Content-Type"];
[urlRequest setValue:[NSString stringWithFormat:mad:"%d",[soapRequestStr length]]
forHTTPHeaderField:mad:"Content-Length"];
[urlRequest setValue:soapAction forHTTPHeaderField:mad:"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
 

RavingMac

Well-known member
Staff member
Moderator
Joined
Jan 7, 2008
Messages
8,303
Reaction score
242
Points
63
Location
In Denial
Your Mac's Specs
16Gb Mac Mini 2018, 15" MacBook Pro 2012 1 TB SSD
POLL Deleted

You will get better response and help by clearly stating your question/request for help at the beginning of your post.
 
OP
U
Joined
Mar 21, 2012
Messages
2
Reaction score
0
Points
1
POLL Deleted

You will get better response and help by clearly stating your question/request for help at the beginning of your post.

I need to send Synchronous request to https server, i am able to send sync request to http server, but same code is not working for https server
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top