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

查看:126
本文介绍了需要有关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生成)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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