Handling SUDZC's response result-NSMutableArra

2019-08-03 07:54发布

I am using SUDZC with a web service that responds with several different arrays: E_ANT, EFULLNAME, E_RULE, E_VACDAYS. But when I take a look into the request result there are only the values for the E_ANT visible. How can I access the other items or is this not possible with sudzc?

<n0:Z_COM_URL_GETRECORDSResponse xmlns:n0="urn:sap-com:document:sap:rfc:functions">
     <E_ANT>
        <item>
           <MANDT>010</MANDT>
           <USERID>00000016</USERID>
           <VAC_DATE>2012-01-09</VAC_DATE>
        </item>
        <item>
           <MANDT>010</MANDT>
           <USERID>00000016</USERID>
           <VAC_DATE>2012-02-01</VAC_DATE>
       </item>
      ....
       <item>
           <MANDT>010</MANDT>
           <USERID>00000016</USERID>
           <VAC_DATE>2012-03-15</VAC_DATE>
        </item>
     </E_ANT>
     <E_FULLNAME>Vanessa Martinez</E_FULLNAME>
     <E_RULE>
        <item>
           <MANDT>010</MANDT>
           <USERID>00000016</USERID>
           <DATE_FROM>2008-01-07</DATE_FROM>
           <DATE_TO>9999-12-31</DATE_TO>
           <VAC_ENTITLE>30.0</VAC_ENTITLE>
           <ERNAM_ID>00004001</ERNAM_ID>
           <ERDAT>2008-01-15</ERDAT>
        </item>
     </E_RULE>
     <E_VACDAYS>
        <MANDT>010</MANDT>
        <USERID>00000016</USERID>
        <KJAHR>2012</KJAHR>
        <VAC_THIS_YEAR>30.0</VAC_THIS_YEAR>
     </E_VACDAYS>
     <E_VACPAID/>
  </n0:Z_COM_URL_GETRECORDSResponse>

标签: sudzc
1条回答
Anthone
2楼-- · 2019-08-03 08:01

My output was not in xml. Are you showing us the output from sudzc or the actual xml data? This is how I extracted my sudzc data

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;
}

...

查看更多
登录 后发表回答