如何将值数组传递给 SudzC 生成的 Web 服务类?
我有一个从 WSDL 生成的 sudzc 服务类,它接受 ArrayOfInt 和 ArrayOfString 对象作为参数。服务方法签名是这样的:
- (SoapRequest*) Search: (id <SoapDelegate>) handler filters: (NSMutableArray*) displayedAttributes: (NSMutableArray*) displayedAttributes;
我的问题是,如何将值传递到需要 NSMutableArrays 的参数中?
在上面的方法签名中,“displayedAttributes”参数需要一个 ArrayOfInt
对象(应使用 int 标记中的多个整数填充,例如
)。
然而,我尝试过的这些方法都不起作用:
- 直接传递 (int) 对象的 NSArray/NSMutableArray
- 直接传递 NSNumber 对象的 NSArray/NSMutableArray
- 传递包含 @"1"、@"2"、@ 的字符串数组"3" 等
- 传递已包含
@"
、1 "@"
的字符串数组> 等2 " - 根据整数从字符串中构造
CXMLDocument
我确信下载中的随附文档对此进行了某种解释 - 目前我还不清楚。
I have a sudzc service class generated from a WSDL that accepts an ArrayOfInt and ArrayOfString objects as parameters. The service method signature is this:
- (SoapRequest*) Search: (id <SoapDelegate>) handler filters: (NSMutableArray*) displayedAttributes: (NSMutableArray*) displayedAttributes;
My question is, how do I pass values into the parameters that expect NSMutableArrays?
In the above method signature, the "displayedAttributes" parameter is expecting an ArrayOfInt
object (which should be populated with several integers in an int tag, e.g., <int>1</int><int>2</int><int>3</int>
etc).
However none of these things which I've tried have worked:
- Directly passing an NSArray/NSMutableArray of (int) objects
- Directly passing an NSArray/NSMutableArray of NSNumber objects
- Passing an array of strings containing @"1", @"2", @"3" etc
- Passing an array of strings that already contain
@"<int>1</int>"
,@"<int>2</int>"
, etc - Constructing a
CXMLDocument
out of a string based on the integers
I'm sure this is somehow explained in the accompanying documentation in the download -- it's just not clear to me at the moment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
@Jon Limjap:你很幸运!它要求你提供一个你之前处理过的类型,我有 SudzC 为我生成的自定义类类型(!)...它仅在传递 CXMLNode 时初始化,(需要 CXMLDocument / CXMLElement)..我不知道如何处理这样的类型...
一个实例是:filter是一个类,我有一个过滤器的类,但是没有办法初始化它,(除了alloc-init然后设置它的属性,但它的属性是另一个这样的自定义类型.. !!!!!!)...如果您知道任何“技巧”来告诉/配置 sudzc 以允许我们传递对象或获取可可类型的对象,请告诉我...
@Jon Limjap: Lucky you are!!! it asks you for a type which you have dealt before, I have custom class type that SudzC generated for me (!)... It initializes only when passed CXMLNode, (which need CXMLDocument / CXMLElement).. I have no idea how to deal with such type...
an instance is: filter is a class, I have a class of the filter, but there is no way to initialize it, (except alloc-init and then setting its properties, but its properties are another such custom type.. !!!!)...If you know any "trick" to tell/configure sudzc to allow us to pass objects or fetch objects of cocoa type, do tell me....
我也遇到过类似的情况,将对象数组传递给 SOAP 请求。我通过进行以下更改设法使其正常工作。
SOAP 数组的情况没有添加,
更改以下方法
所以我设法在 SOAP 请求时
,传递元素 arr 对象您的 SOAP 请求?
I had similar situation of passing array of objects to SOAP request. I managed to get it working by doing following changes.
SOAP array case in not added in
so I managed to change in the following method
at the time SOAP request,
Pass element arr object your SOAP Request ??
这有点旧,但我希望它能对某人有所帮助。我以这种方式在 SoapArray 上实现了
serialize:
方法:如您所见,有一些注释行。如果取消注释它们并注释 for 中当前使用的标记,您将获得一个名为 name 的标记,其中包含用内容类名称标记的对象。
This is a bit old, but I hope it will help someone. I implemented the
serialize:
method on SoapArray this way:As you can see, there are some commented lines. If you uncomment them and comment the currently used one inside the for, you will get a tag named name which will contain objects tagged with the content class name.