Need help on Objective-C code (WSDL2ObjC generated)(需要有关 Objective-C 代码的帮助(生成的 WSDL2ObjC))
问题描述
在 WSDL2ObjC 文档中有如下示例代码,但在我生成的代码中,我找不到任何与myOperationUsingParameters"等效的类、方法或属性那是什么,我在哪里可以找到它?我也不知道myOperation"和ns1"是什么.
In the WSDL2ObjC documentation there is a sample code like below, but in my generated code I couldnt find any class, method or property equavilant to "myOperationUsingParameters" what is that and where can I find it? I don't know also what "myOperation" and what "ns1" is.
我是新手,所以在Objective C中,当我以某种方式更改变量的大写并将它们与一些关键字连接时,可能有什么意义?
I'm newbie, so in Objective C maybe there is a meaning when I change the capitals of variables in a certain way and concatenate them with some keywords?
例如:ns1_MyOperationRequest -- myOperationUsingParameters
for instance: ns1_MyOperationRequest -- myOperationUsingParameters
tnx
#import "MyWebService.h"
MyWebServiceBinding *binding = [MyWebService MyWebServiceBinding];
binding.logXMLInOut = YES;
ns1_MyOperationRequest *request = [[ns1_MyOperationRequest new] autorelease];
request.attribute = @"attributeValue";
request.element = [[ns1_MyElement new] autorelease];
request.element.value = @"elementValue"];
MyWebServiceBindingResponse *response = [binding myOperationUsingParameters:request];
推荐答案
这一切都取决于您的 Web 服务类名称等,因为 wsdl2objc 构成了许多基于此的 NSObject 和方法,但是,这表明您使用的是 soap 1.2 绑定并且您的 Web 服务被称为SimpleService",下面将调用一个名为MobileTestService"的 Web 方法并从生成的 xml 返回整数值.
All depends on your web service class name etc as wsdl2objc makes up alot of your NSObjects and methods based upon this, however, suggesting that you are using soap 1.2 bindings and your web service was called 'SimpleService', the following would call a web method named 'MobileTestService and return back the integer value from the xml generated.
-(NSString *)returnThatStringFromWebServiceResult
{
SimpleServiceSoap12Binding * binding = [SimpleService SimpleServiceSoap12Binding];
binding.logXMLInOut = YES; // shows all in the console log.
SimpleService_concat * testParams = [[SimpleService_concat new]autorelease];
testParams.s1 = someTextField.text; // parameters all become properties of this testParams object
testParams.s2 = anotherTextField.text;
SimpleServiceSoap12BindingResponse * response= [binding SimpleService_concatUsingParameters:testParams];
[response self]; // removes compile error
NSArray * responseBodyParts = response.bodyParts;
NSError * responseError = response.error;
if (responseError!=NULL)
{
return @""; // if error from ws use [responeError code]; for http err code
}
for (id bodyPart in responseBodyParts)
{
if ([bodyPart isKindOfClass:[SimpleService_concat_Response class]])
{
SimpleService_concatResponse* body = (SimpleService_concatResponse*) bodyPart;
return body.SimpleService_concatResult; // if you are returning a string from your WS then this value will be a string,
}
}
这篇关于需要有关 Objective-C 代码的帮助(生成的 WSDL2ObjC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:需要有关 Objective-C 代码的帮助(生成的 WSDL2ObjC)


基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01