1

sudzc.com を使用して、iOS で SOAP Web サービスにアクセスしようとしています。お返しに石鹸の封筒がもらえるらしい。しかし、私は結果を処理する方法がわかりません。どういうわけか結果を NSDictionary に入れることはできますか、またはどのように進めますか?

    - (void)run {
// Create the service
SDZDevices2Api* service = [SDZDevices2Api service];
service.logging = YES;
    // Returns NSString*. (added searchstring and max count values)
[service LocationFindSimple:self action:@selector(LocationFindSimpleHandler:) SearchString: @"Vejle" Max: 1 BankId: [NSMutableArray array] BankName: [NSMutableArray array] Id: [NSMutableArray array] Name: [NSMutableArray array] Icon: [NSMutableArray array] Zip: [NSMutableArray array] Attributes: [NSMutableArray array]];
   }

// Handle the response from LocationFindSimple.

- (void) LocationFindSimpleHandler: (id) value {

// Handle errors
if([value isKindOfClass:[NSError class]]) {
    NSLog(@"%@", value);
    return;
}

// Handle faults
if([value isKindOfClass:[SoapFault class]]) {
    NSLog(@"%@", value);
    return;
}

// Do something with the NSString* result
  NSString* result = (NSString*) value;
    NSLog(@"LocationFindSimple returned the value: %@", result);
}

これはログメッセージです:

http://pastebin.com/JycGq4Du

4

1 に答える 1

0

私はこれで他の誰かを助けました:ここ

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:@"E_AN"];
if( ( resp == nil ) || ![resp isKindOfClass:[NSDictionary class]] ) {

NSLog(@"ERROR: E_AN not a dictionary");
return;
}
dict = [resp objectForKey:@"item"];
if( ( dict == nil ) || ![dict isKindOfClass:[NSDictionary class]] ) {

NSLog(@"ERROR: item not a dictionary");
return;
}
resp = [dict objectForKey:@"MANDT"];
if( ( resp == nil ) || ![resp isKindOfClass:[NSDictionary class]] ) {

NSLog(@"ERROR: MANDT not a dictionary");
return;
}
于 2013-10-25T19:06:47.560 に答える