处理SUDZC的响应结果-NSMutableArray

时间:2012-03-22 19:21:40

标签: sudzc

我正在使用SUDZC和一个响应几个不同数组的Web服务:E_ANT,EFULLNAME,E_RULE,E_VACDAYS。但是当我查看请求结果时,只有E_ANT的值可见。我怎样才能访问其他项目,或者这对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>

1 个答案:

答案 0 :(得分:1)

我的输出不在xml中。您是否向我们展示了sudzc或实际xml数据的输出? 这就是我提取sudzc数据的方法

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

...