Hi ,
Thanks Jitender and midhun.
I have tried the steps in the which you guys given for the reference.
I getting the below error for the post code the below.
CODE:
NSString *message =[NSString stringWithFormat:@"<?xml version='1.0' encoding='utf-8'?>\n"
"<entry xml:base='http:/192.168.6.5:8080/odata/applications/latest/com.mcustomer/Connections'\n""xmlns='http://www.w3.org/2005/Atom'\n" "xmlns:m='http://schemas.microsoft.com/ado/2007/08/dataservices/metadata'\n"
"xmlns:d='http://schemas.microsoft.com/ado/2007/08/dataservices'>\n"
"<content type='application/xml'>\n"
"<m:properties>\n"
"<d:DeviceType>iphone</d:DeviceType>\n"
"</m:properties>\n"
@"</content> \n"
"</entry>\n"];
// <entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
//xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
// @"<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xml:base="http://192.168.6.5:8080/odata/applications/latest/com.mcustomer//">
// <workspace>
// <atom:title>Default</atom:title>
// <collection href="Endpoints">
// <atom:title>Endpoints</atom:title>
// </collection>
// <collection href="Connections">
// <atom:title>Connections</atom:title>
// </collection>
// </workspace>
// </service>
NSLog(@"PostMessage:%@",message);
NSString *userId=@"smpAdmin";
NSString *password=@"Welcome1";
NSString * posturl = @"http:/192.168.6.5:8080/odata/applications/latest/com.mcustomer/Connections";
NSURL *url=[NSURL URLWithString:[posturl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *authStr = [NSString stringWithFormat:@"%@:%@", userId, password];
NSData *authData = [authStr dataUsingEncoding:NSASCIIStringEncoding];
NSString *authValue = [NSString stringWithFormat:@"Basic %@", [Base64 encode:authData]];
NSMutableURLRequest *postrequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30];
[postrequest setHTTPMethod:@"POST"];
[postrequest addValue:@"Basic c21wQWRtaW46V2VsY29tZTAx" forHTTPHeaderField:@"Authorization"];
[postrequest setValue:@"application/xml" forHTTPHeaderField:@"Content-Type"];
[postrequest addValue:@" " forHTTPHeaderField:@"X-SMP-APPCID"];
[postrequest setHTTPBody: [message dataUsingEncoding:NSUTF8StringEncoding]];
postconnectionForXCsrf = [[NSURLConnection alloc] initWithRequest:postrequest delegate:self];
if(postconnectionForXCsrf )
{
webdata = [NSMutableData data];
webdata = [[NSMutableData alloc] init];
}
else
{
NSLog(@"Authentication Error");
}
ERROR:
2014-10-01 17:26:30.138 Testsmp3[3440:108841] PostMessage:<?xml version='1.0' encoding='utf-8'?>
<entry xml:base='http:/192.168.6.5:8080/odata/applications/latest/com.mcustomer/Connections'
xmlns='http://www.w3.org/2005/Atom'
xmlns:m='http://schemas.microsoft.com/ado/2007/08/dataservices/metadata'
xmlns:d='http://schemas.microsoft.com/ado/2007/08/dataservices'>
<content type='application/xml'>
<m:properties>
<d:DeviceType>iphone</d:DeviceType>
</m:properties>
</content>
</entry>
2014-10-01 17:26:30.605 Testsmp3[3440:108841] <?xml version="1.0" encoding="utf-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="http://Local host:8080/odata/applications/latest/com.mcustomer/"><id>http://192.168.6.5:8080/odata/applications/latest/com.mcustomer/Connections('ae01f193-ecb3-4952-90d4-3817aa76f954')</id><title type="text"></title><updated>2014-10-01T11:56:32Z</updated><author><name></name></author><link rel="edit" title="Connection" href="Connections('ae01f193-ecb3-4952-90d4-3817aa76f954')"></link><category term="applications.Connection" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category><content type="application/xml"><m:properties><d:ETag>2014-10-01 17:26:32.0</d:ETag><d:ApplicationConnectionId>ae01f193-ecb3-4952-90d4-3817aa76f954</d:ApplicationConnectionId><d:AndroidGcmPushEnabled m:type="Edm.Boolean">false</d:AndroidGcmPushEnabled><d:AndroidGcmRegistrationId m:null="true"></d:AndroidGcmRegistrationId><d:AndroidGcmSenderId></d:AndroidGcmSenderId><d:ApnsPushEnable m:type="Edm.Boolean">false</d:ApnsPushEnable><d:ApnsDeviceToken m:null="true"></d:ApnsDeviceToken><d:ApplicationVersion>1.0</d:ApplicationVersion><d:BlackberryPushEnabled m:type="Edm.Boolean">false</d:BlackberryPushEnabled><d:BlackberryDevicePin m:null="true"></d:BlackberryDevicePin><d:BlackberryBESListenerPort m:type="Edm.Int32">0</d:BlackberryBESListenerPort><d:BlackberryPushAppID m:null="true"></d:BlackberryPushAppID><d:BlackberryPushBaseURL m:null="true"></d:BlackberryPushBaseURL><d:BlackberryPushListenerPort m:type="Edm.Int32">0</d:BlackberryPushListenerPort><d:BlackberryListenerType m:type="Edm.Int32">0</d:BlackberryListenerType><d:ConnectionLogLevel>NONE</d:ConnectionLogLevel><d:CustomizationBundleId m:null="true"></d:CustomizationBundleId><d:CustomCustom1></d:CustomCustom1><d:CustomCustom2></d:CustomCustom2><d:CustomCustom3></d:CustomCustom3><d:CustomCustom4></d:CustomCustom4><d:DeviceModel m:null="true"></d:DeviceModel><d:DeviceType>iPhone</d:DeviceType><d:DeviceSubType m:null="true"></d:DeviceSubType><d:DevicePhoneNumber m:null="true"></d:DevicePhoneNumber><d:DeviceIMSI m:null="true"></d:DeviceIMSI><d:MpnsChannelURI m:null="true"></d:MpnsChannelURI><d:MpnsPushEnable m:type="Edm.Boolean">false</d:MpnsPushEnable><d:PasswordPolicyEnabled m:type="Edm.Boolean">false</d:PasswordPolicyEnabled><d:PasswordPolicyDefaultPasswordAllowed m:type="Edm.Boolean">false</d:PasswordPolicyDefaultPasswordAllowed><d:PasswordPolicyMinLength m:type="Edm.Int32">8</d:PasswordPolicyMinLength><d:PasswordPolicyDigitRequired m:type="Edm.Boolean">false</d:PasswordPolicyDigitRequired><d:PasswordPolicyUpperRequired m:type="Edm.Boolean">false</d:PasswordPolicyUpperRequired><d:PasswordPolicyLowerRequired m:type="Edm.Boolean">false</d:PasswordPolicyLowerRequired><d:PasswordPolicySpecialRequired m:type="Edm.Boolean">false</d:PasswordPolicySpecialRequired><d:PasswordPolicyExpiresInNDays m:type="Edm.Int32">0</d:PasswordPolicyExpiresInNDays><d:PasswordPolicyMinUniqueChars m:type="Edm.Int32">0</d:PasswordPolicyMinUniqueChars><d:PasswordPolicyLockTimeout m:type="Edm.Int32">0</d:PasswordPolicyLockTimeout><d:PasswordPolicyRetryLimit m:type="Edm.Int32">20</d:PasswordPolicyRetryLimit><d:ProxyApplicationEndpoint>http://serveraddress.213:8000/sap/opu/odata/sap/ZMCUST_SRV</d:ProxyApplicationEndpoint><d:ProxyPushEndpoint>http://user-PC:8080/Notification</d:ProxyPushEndpoint><d:UploadLogs>false</d:UploadLogs><d:WnsChannelURI m:null="true"></d:WnsChannelURI><d:WnsPushEnable m:type="Edm.Boolean">false</d:WnsPushEnable></m:properties></content></entry>
Could please help me out what excatly the above error means.And when im running the code it is not coming to - (void)connectionDidFinishLoading:(NSURLConnection *)connection.
Thanks.