处理SUDZC的响应结果-NSMutableArray [英] Handling SUDZC's response result-NSMutableArray

查看:81
本文介绍了处理SUDZC的响应结果-NSMutableArray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将SUDZC与Web服务一起使用,该服务响应几个不同的数组:E_ANT,EFULLNAME,E_RULE,E_VACDAYS.但是,当我查看请求结果时,只有E_ANT的值可见.我如何才能访问其他项目,或者使用sudzc无法做到这一点?

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>

推荐答案

我的输出不在xml中.您是在向我们显示sudzc的输出还是实际的xml数据? 这就是我提取sudzc数据的方式

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

...

这篇关于处理SUDZC的响应结果-NSMutableArray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆