I'm trying to grab specific data with sudzc generated file. I've used their example code to get me to the point of cxmlnode* result = (cxmlnode*)value;
it gives me nslog of: .....
"description" = "Test Description";
...
How can I grab the data Test Description to put in a variable?
does anyone know if it has to be parsed with json? the format is not xml. i'm a newbie and still having the problem.
I figured it out by using an NSDictionary:
if( [value isKindOfClass:[NSError class]] || [value isKindOfClass:[SoapFault class]] ) {
NSLog(@"%@", [value description]);
return;
}
// Verify we're a dictionary
if( ![value isKindOfClass:[NSDictionary class]] ) {
NSLog(@"ERROR: Response not a dictionary");
return;
}
NSDictionary* dict = (NSDictionary*)value;
NSDictionary* resp = [dict objectForKey:@"UpdateQOHLookupItemResult"];
if( ( resp == nil ) || ![resp isKindOfClass:[NSDictionary class]] ) {
NSLog(@"ERROR: UpdateQOHLookupItemResult not a dictionary");
return;
}
dict = [resp objectForKey:@"firstTierKey"];
if( ( dict == nil ) || ![dict isKindOfClass:[NSDictionary class]] ) {
NSLog(@"ERROR: Diffgram not a dictionary");
return;
}
resp = [dict objectForKey:@"secondTierKey"];
if( ( resp == nil ) || ![resp isKindOfClass:[NSDictionary class]] ) {
NSLog(@"ERROR: NewDataSet not a dictionary");
return;
}
Very easy in your All Ouput windows during the debugging session (set breakpoint in the handler), enter: po result. Then it will display the returned XML!! It's not JSON, since SUDZC is using SOAP. I have a project with .Net back end using SUDZC and working perfectly. You will need to adapt the generated code by SUDZC to fit your needs. The best way to start is to LOG the returned XML before deserialization in the SOAPRequest.m file. Use NSLog in the method connectionDidFinishLoading. You also might need this: http://www.dailycode.info/Blog/post/2012/08/10/Sudzc-code-generator-is-missing-SoapDictionary.aspx