需要有关 Objective-C 代码的帮助(生成 WSDL2ObjC) [英] Need help on Objective-C code (WSDL2ObjC generated)

查看:19
本文介绍了需要有关 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 构成了您的大量 NSObjects 和基于此的方法,但是,建议您使用的是 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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