Click here to Skip to main content
15,892,253 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi I have a web service which is hosted at the url which starts with HTTPS
I am trying to post data to this url from IOS Iphone.
But not able to hit to server.
Do i need to Confirm security Certificates or anything.
Thanks for the help in advance.

FYI Below is the code.


C#
url=@"https://dev-jayporec.netsolutions.in/apicallback/cart/makePayment";
    
    NSString *combinedDataStr = [NSString stringWithFormat:@"{\"Shipping\":{\"mode\":\"%@\",\"firstname\":\"%@\",\"lastname\":\"%@\",\"company\":\"%@\",\"street\":\"%@\",\"city\":\"%@\",\"region\":\"%@\",\"region_id\":\"%@\",\"postcode\":\"%@\",\"country_id\":\"%@\",\"telephone\":\"%@\",\"fax\":\"%@\",\"is_default_shipping\":\"%@\",\"is_default_billing\":\"%@\"},\"Billing\":{\"mode\":\"%@\",\"firstname\":\"%@\",\"lastname\":\"%@\",\"company\":\"%@\",\"street\":\"%@\",\"city\":\"%@\",\"region\":\"%@\",\"region_id\":\"%@\",\"postcode\":\"%@\",\"country_id\":\"%@\",\"telephone\":\"%@\",\"fax\":\"%@\",\"is_default_shipping\":\"%@\",\"is_default_billing\":\"%@\"},\"userId\":\"%@\",\"cartId\":\"%@\",\"cardToken\":\"%@\",\"isNew\":\"%@\",\"cc_exp_year\":\"%@\",\"cc_exp_month\":\"%@\",\"cc_type\":\"%@\",\"cc_number\":\"%@\",\"cc_exp_date\":\"%@\",\"cc_cid\":\"%@\",\"user_credit\":\"%@\"}",@"shipping",ShippingFirstName,ShippingLastName,@"",ShippingAddress,ShippingCity,ShippingState,ShippingRegionID,ShippingZipCode,ShippingCountry,@"000",@"",@"0",@"0",@"billing",BillingFirstName,BillingLastName,@"",BillingAddress,BillingCity,BillingState,BillingRegionID,BillingZipCode,BillingCountry,@"000",@"",@"0",@"0",UserID,CartID,CardToken,IsNew,ExpYear,ExpMonth,CCType,CCNo,CCNoExpDate,CCNoCVV,UserCredit];

NSMutableURLRequest *request =nil;
    if(!delegate)
        delegate =(AppDelegate *)[[UIApplication sharedApplication]delegate];

    NSString *req=[NSString stringWithFormat:@"%@/device/%@",recievedRequestURL,delegate.deviceType];

    request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:req]];

    [request setHTTPMethod:requestType];
    [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

    if([requestType isEqualToString:@"POST"])
    {

        NSData* requestData = [combinedDataStr dataUsingEncoding:NSUTF8StringEncoding];
        [request setHTTPBody: requestData];
        //NSLog(@"Request %@",request);
    }


A Normal HTTP request is working but not the HTTPS..


Regards.
Posted
Updated 2-Jul-12 19:27pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900