Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Apple Mobile Products: iPhone, iPad, iPod
iOS and Apps
How to send HTTPS synchronous request to server using SOAP web services
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="umeshchalla" data-source="post: 1385504" data-attributes="member: 244175"><p>NSString *urlString=@"http://projdemo.com/MobileWebServices/Service.asmx"; </p><p>soapRequestStr = [self CreateRequest]; </p><p>NSString* soapAction; </p><p>soapAction =@"http://www.projdemo.com/FetchAll"; </p><p>urlRequest=NULL; </p><p>responseData=NULL; </p><p>httpBodyData=[soapRequestStr dataUsingEncoding: NSUTF8StringEncoding]; </p><p>url=[[NSURL alloc]initWithString: urlString]; </p><p>urlRequest = [NSMutableURLRequest requestWithURL:url]; </p><p>[urlRequest setHTTPMethod<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"POST"]; </p><p>[urlRequest setHTTPBody:httpBodyData]; </p><p>[urlRequest setValue<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"projdemo.com" forHTTPHeaderField<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"Host"]; </p><p>[urlRequest setValue<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"text/xml; charset=utf-8" forHTTPHeaderField<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"Content-Type"]; </p><p>[urlRequest setValue<img src="/mac_images/images/smilies/Embarrassed.png" class="smilie" loading="lazy" alt=":[" title="Embarrassed :[" data-shortname=":[" />NSString stringWithFormat<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"%d",[soapRequestStr length]] </p><p>forHTTPHeaderField<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"Content-Length"]; </p><p>[urlRequest setValue:soapAction forHTTPHeaderField<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite4" alt=":mad:" title="Mad :mad:" loading="lazy" data-shortname=":mad:" />"SOAPAction"]; </p><p>responseData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil </p><p>error:nil]; </p><p>response = nil; </p><p>error = nil; </p><p>responseString=NULL; </p><p>responseString = [[NSString alloc] initWithData:responseData </p><p>encoding:NSASCIIStringEncoding]; </p><p>NSLog(@"data is %@",responseData); </p><p>NSLog(@"Response string is %@",responseString);</p><p></p><p></p><p>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</p><p></p><p>Error Response:</p><p></p><p><html><head> </p><p><title>400 Bad Request</title> </p><p></head><body> </p><p><h1>Bad Request</h1> </p><p><p>Your browser sent a request that this server could not understand.<br /> </p><p></p> </p><p><hr> </p><p><address>Apache/2.2.20 (Ubuntu) Server at projdemo.com Port 443</address> </p><p></body></html> </p><p></p><p>My problem is how to send soap request to https server</p></blockquote><p></p>
[QUOTE="umeshchalla, post: 1385504, member: 244175"] 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 setValue:[NSString 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 [/QUOTE]
Verification
Post reply
Forums
Apple Mobile Products: iPhone, iPad, iPod
iOS and Apps
How to send HTTPS synchronous request to server using SOAP web services
Top