# Help Needed related response from server

**URL:** <https://discussions.flightaware.com/t/help-needed-related-response-from-server/13326>\
**Category:** AeroAPI\
**Created:** [September 24, 2012, 5:40am UTC](https://discussions.flightaware.com/t/help-needed-related-response-from-server/13326 "2012-09-24T05:40:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![timgodfrey2](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@timgodfrey2](https://discussions.flightaware.com/u/timgodfrey2)\
**Post date:** [September 24, 2012, 5:40am UTC](https://discussions.flightaware.com/t/help-needed-related-response-from-server/13326/1 "2012-09-24T05:40:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [September 24, 2012, 6:00am UTC](https://discussions.flightaware.com/t/help-needed-related-response-from-server/13326/2 "2012-09-24T06:00:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![timgodfrey2](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@timgodfrey2](https://discussions.flightaware.com/u/timgodfrey2)\
**Post date:** [September 26, 2012, 8:16am UTC](https://discussions.flightaware.com/t/help-needed-related-response-from-server/13326/3 "2012-09-26T08:16:26Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [September 26, 2012, 3:30pm UTC](https://discussions.flightaware.com/t/help-needed-related-response-from-server/13326/4 "2012-09-26T15:30:12Z")

</div>

> [@timgodfrey2](#):
>
> 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](http://flightxml.flightaware.com/soap/FlightXML2/FlightInfoEx)”];   
> NSMutableDictionary_ jsonObject = [NSMutableDictionary dictionary];

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

```auto

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

```

> [@timgodfrey2](#):
>
> ```
> [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);

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).
