on 10-13-2011 8:31 AM
Hello,
I'm developing an app in iphone and want to use JSON webservice. Can anyone please guide me how to use json format with abap webservices or any document suggesting?
Thanks in Advance
Hi oztahir,
Please read my post on [SAPDEV|http://www.sapdev.nl] to see how I did it. I used ASIHTTPRequest for communication with the JSON web service and KissXML to pase the XML.
Cheers,
Raymond
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tahir,
First create a web service in SAP. The blog by Uwe Kunath descibes this clearly. Then create an Xcode project and use the ASIHTTPRequest wrapper to connect to the web service. Parse the response with the KissXML parser. A more out of the box solution is NetWeaver Gateway. It also let you use SAP web services but it also generates iOs code for you. SAP just released a trial version in de download section.
Example of ASIHTTPRequest
- (void)getFlightData:(NSString *) selectedDate {
NSURL *url = [NSURL URLWithString:@"http://abap.sapdev.nl:8000/sap/resources/flights/from/%/to/%/date/20110128?sap-client=001"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setUsername:@"BCUSER"];
[request setPassword:@"minisap"];
[request startSynchronous];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
[self parseXML:response];
}
}
Example of KissXML
-(void)parseXML:(NSString*)source {
NSError *error = nil;
DDXMLDocument *theDocument = [[DDXMLDocument alloc] initWithXMLString:source options:0 error:&error];
NSArray *results = [theDocument nodesForXPath:@"/asx:abap/asx:values/TAB/BAPISFLDAT" error:&error];
for (DDXMLElement *flightdetail in results) {
NSString *airlineid = [[flightdetail elementForName:@"AIRLINEID"] stringValue];
NSString *airline = [[flightdetail elementForName:@"AIRLINE"] stringValue];
}
}
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.