Help Needed related response from server


#1

Error Domain=kCFErrorDomainCFNetwork Code=303 “The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)” UserInfo=0x4c25c90 {NSErrorFailingURLKey=http://flightxml.flightaware.com/soap/FlightXML2/wsdl, NSErrorFailingURLStringKey=http://flightxml.flightaware.com/soap/FlightXML2/wsdl}


#2

What SOAP library are you using for Objective C?

If you are trying to write your own code to construct raw XML requests for the SOAP interface, then I would recommend not doing that and instead using the JSON interface since the protocol is much simpler and is far less verbose.


#3

I used JASON library and i send a sample request to Server the Code of sample request is as
NSURL url = [NSURL URLWithString:@“http://flightxml.flightaware.com/soap/FlightXML2/FlightInfoEx”];
NSMutableDictionary
jsonObject = [NSMutableDictionary dictionary];

[jsonObject setObject:@"timgodfrey2" forKey:@"UserName"];
[jsonObject setObject:@"xxxxxxxxxxx" forKey:@"Apikey"];
[jsonObject setObject:@"ident" forKey:@"N12345"];
[jsonObject setObject:@"howMany" forKey:@"1"];
[jsonObject setObject:@"offset" forKey:@"2"];

NSString* jsonRequest = [jsonObject JSONRepresentation];
NSLog(@“Request: %@”, jsonRequest);

NSMutableURLRequest *request = [NSMutableURLRequest alloc] initWithURL:url];
NSData *requestData = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]];

[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"json" forHTTPHeaderField:@"Data-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];

NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil ];
NSString *returnString = [NSString alloc] initWithData:returnData encoding: NSUTF8StringEncoding];

NSLog(@"returnData: %@", returnString);

then server send me response is that
returnData:

500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [support@flightaware.com](mailto:support@flightaware.com) and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Regards,
Tim


#4

The URL is incorrect if you intend to use REST/JSON. As indicated on flightaware.com/commercial/fligh … ation2.rvt the URL will need to be:



NSURL *url = [NSURL URLWithString:@"http://flightxml.flightaware.com/json/FlightXML2/FlightInfoEx"];	


The authentication values need to be supplied using HTTP Basic Authentication headers in the HTTP request (not as JSON request).

Additionally, the ident/howMany/offset arguments should be supplied as GET arguments (although POST form “application/x-www-form-urlencoded” will probably work too, but GET is preferred for improved cachability).